# \#gen\_tcp

**URL:** https://erlangforums.com/tag/gen-tcp/642.md

[Latest](https://erlangforums.com/latest.md) · [Categories](https://erlangforums.com/categories.md) · [Tags](https://erlangforums.com/tags.md)

---

## [Does all data passed to gen\_tcp:send/2 eventually get sent when it returns timeout?](https://erlangforums.com/t/does-all-data-passed-to-gen-tcp-send-2-eventually-get-sent-when-it-returns-timeout/5459)

<div class="topic-metadata">

**Author:** [@zuiderkwast](https://erlangforums.com/u/zuiderkwast)\
**Replies:** 5\
**Last updated:** [March 17, 2026, 1:31pm UTC](https://erlangforums.com/t/does-all-data-passed-to-gen-tcp-send-2-eventually-get-sent-when-it-returns-timeout/5459 "2026-03-17T13:31:32Z")

</div>

gen\_tcp:send/2 can hang when the OS send buffer is full and inet’s internal send buffer reaches the high watermark. When the call hangs, it makes the process unresponsive. To prevent gen\_tcp:send/2 from hanging, it’s po…

---

## [Why gen\_tcp:unrecv/2 is not documented?](https://erlangforums.com/t/why-gen-tcp-unrecv-2-is-not-documented/4651)

<div class="topic-metadata">

**Author:** [@parsa](https://erlangforums.com/u/parsa)\
**Replies:** 0\
**Last updated:** [April 6, 2025, 7:55pm UTC](https://erlangforums.com/t/why-gen-tcp-unrecv-2-is-not-documented/4651 "2025-04-06T19:55:18Z")

</div>

Hi, in gen\_tcp.erl source there is an exported function unrecv/2 which was mentioned in a stackoverflow question 10 years ago for a peek like functionality. https://stackoverflow.com/questions/26688715/erlang-discernin…

---

## [Unexpected "send closed" message since OTP 27.3.1](https://erlangforums.com/t/unexpected-send-closed-message-since-otp-27-3-1/4624)

<div class="topic-metadata">

**Author:** [@holger](https://erlangforums.com/u/holger)\
**Replies:** 2\
**Last updated:** [March 31, 2025, 10:02am UTC](https://erlangforums.com/t/unexpected-send-closed-message-since-otp-27-3-1/4624 "2025-03-31T10:02:09Z")

</div>

Compiling the module shown below and calling example:run(). yields the following output for me: Client: Connection closed. handle\_recv\_error(2599) -\> send closed to \<0.101.0\> when Reason: closed ShowReason: cl…

---

## [Gen\_tcp.recv randomly gets stuck](https://erlangforums.com/t/gen-tcp-recv-randomly-gets-stuck/4444)

<div class="topic-metadata">

**Author:** [@jjedele](https://erlangforums.com/u/jjedele)\
**Replies:** 4\
**Last updated:** [February 4, 2025, 7:54pm UTC](https://erlangforums.com/t/gen-tcp-recv-randomly-gets-stuck/4444 "2025-02-04T19:54:15Z")

</div>

Hey, Erlang (rather Elixir) noob here :slight\_smile: I have some trouble using the gen\_tcp module to implement a simple TCP server program (project in question: GitHub - jjedele/dicom.ex: A DICOM library for Elixir). P…

---

## [How to check if unix domain socket client is listening on the other side](https://erlangforums.com/t/how-to-check-if-unix-domain-socket-client-is-listening-on-the-other-side/3859)

<div class="topic-metadata">

**Author:** [@codeadict](https://erlangforums.com/u/codeadict)\
**Replies:** 2\
**Last updated:** [July 25, 2024, 3:03pm UTC](https://erlangforums.com/t/how-to-check-if-unix-domain-socket-client-is-listening-on-the-other-side/3859 "2024-07-25T15:03:41Z")

</div>

Hi all, I have a TCP client connected to a UNIX domain socket with gen\_tcp with: {ok, port} = gen\_tcp:connect({local, "/tmp/cool.sock"}, 0, \[{active, false}, {packet, raw}\]) If I kill the OS process that serves in /tm…

---

## [Not getting tcp\_closed](https://erlangforums.com/t/not-getting-tcp-closed/3260)

<div class="topic-metadata">

**Author:** [@Jale](https://erlangforums.com/u/Jale)\
**Replies:** 1\
**Last updated:** [February 2, 2024, 1:25pm UTC](https://erlangforums.com/t/not-getting-tcp-closed/3260 "2024-02-02T13:25:36Z")

</div>

Writing a tcp client using gen\_tcp in gen\_server, so after connecting successfully(using gen\_tcp:connect) I am trying to send my tcp server out of reach(disconnecting network from tcp server) and expecting some event at …

---

## [Connection closed on gen\_tcp but not socket when using tcpkali](https://erlangforums.com/t/connection-closed-on-gen-tcp-but-not-socket-when-using-tcpkali/2750)

<div class="topic-metadata">

**Author:** [@ruslandoga](https://erlangforums.com/u/ruslandoga)\
**Replies:** 7\
**Last updated:** [July 21, 2023, 3:11am UTC](https://erlangforums.com/t/connection-closed-on-gen-tcp-but-not-socket-when-using-tcpkali/2750 "2023-07-21T03:11:22Z")

</div>

I’m on a quest to implement a fast acceptor pool in Elixir so I’ve been benchmarking different ones and I noticed that gen\_tcp-based ones don’t seem to work well with GitHub - satori-com/tcpkali: Fast multi-core TCP and …
