# \#socket

**URL:** https://erlangforums.com/tag/socket/388.md

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

---

## [Stale send-timeout timers after a large TCP send with port\_command(..., \[force\])](https://erlangforums.com/t/stale-send-timeout-timers-after-a-large-tcp-send-with-port-command-force/6025)

<div class="topic-metadata">

**Author:** [@EarthOLPoorPlayer](https://erlangforums.com/u/EarthOLPoorPlayer)\
**Replies:** 4\
**Last updated:** [October 5, 2026, 1:17pm UTC](https://erlangforums.com/t/stale-send-timeout-timers-after-a-large-tcp-send-with-port-command-force/6025 "2026-10-05T13:17:27Z")

</div>

Hi, I think I found a possible timer bookkeeping issue in OTP 24’s inet\_drv. The problem appears when a large TCP payload is followed by several smaller payloads, while the application uses: erlang:port\_command(Socket…

---

## [Erlang socket layer throughput improvements](https://erlangforums.com/t/erlang-socket-layer-throughput-improvements/5379)

<div class="topic-metadata">

**Author:** [@NelsonVides](https://erlangforums.com/u/NelsonVides)\
**Replies:** 6\
**Last updated:** [January 19, 2026, 6:30am UTC](https://erlangforums.com/t/erlang-socket-layer-throughput-improvements/5379 "2026-01-19T06:30:10Z")

</div>

I’ve spent a bit of time on the socket layer of OTP as I’ve been working on erlang DNS servers recently. You all know the classic behaviours, gen\_tcp and gen\_udp, but there’s also the much less common socket module, that…

---

## [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…

---

## [erlang:port\_command(Sock, Data, \[force\]) receive timeout reply frequently](https://erlangforums.com/t/erlang-port-command-sock-data-force-receive-timeout-reply-frequently/4392)

<div class="topic-metadata">

**Author:** [@skyman\_cn](https://erlangforums.com/u/skyman_cn)\
**Replies:** 0\
**Last updated:** [January 16, 2025, 7:48am UTC](https://erlangforums.com/t/erlang-port-command-sock-data-force-receive-timeout-reply-frequently/4392 "2025-01-16T07:48:37Z")

</div>

We use Erlang OTP 23, and we use erlang:port\_command(Sock, Data, \[force\]) to send socket message to game client. Read erlang doc: "the force flag:The calling process is not suspended if the port is busy, instead the…

---

## [\`socket\` module is missing SCTP \`peeloff\` API](https://erlangforums.com/t/socket-module-is-missing-sctp-peeloff-api/3153)

<div class="topic-metadata">

**Author:** [@cristconst](https://erlangforums.com/u/cristconst)\
**Replies:** 2\
**Last updated:** [December 29, 2023, 12:06pm UTC](https://erlangforums.com/t/socket-module-is-missing-sctp-peeloff-api/3153 "2023-12-29T12:06:25Z")

</div>

Hi! Any reason why there is no SCTP peeloff API in the socket module? https://www.erlang.org/doc/man/socket Thank you, Cristian

---

## [How to use “SelectInfo” with gen\_sctp sockets?](https://erlangforums.com/t/how-to-use-selectinfo-with-gen-sctp-sockets/3138)

<div class="topic-metadata">

**Author:** [@cristconst](https://erlangforums.com/u/cristconst)\
**Replies:** 3\
**Last updated:** [December 28, 2023, 5:20pm UTC](https://erlangforums.com/t/how-to-use-selectinfo-with-gen-sctp-sockets/3138 "2023-12-28T17:20:41Z")

</div>

Hi! Some context… gen\_sctp:send/4 gets an eagain error because the socket send buffer is full; eventually after some time the network congestion is over and the socket send buffer has some empty space again; thrashing…

---

## [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 …

---

## [Socket NIF and packet\_size - seeing an emsgsize for large TCP messages when the inet\_backend is set to socket](https://erlangforums.com/t/socket-nif-and-packet-size-seeing-an-emsgsize-for-large-tcp-messages-when-the-inet-backend-is-set-to-socket/2528)

<div class="topic-metadata">

**Author:** [@mpope](https://erlangforums.com/u/mpope)\
**Replies:** 2\
**Last updated:** [May 6, 2023, 9:38pm UTC](https://erlangforums.com/t/socket-nif-and-packet-size-seeing-an-emsgsize-for-large-tcp-messages-when-the-inet-backend-is-set-to-socket/2528 "2023-05-06T21:38:31Z")

</div>

I am seeing an emsgsize for large TCP messages when the inet\_backend is set to socket. I saw that there is a packet\_size opt in the documentation and bumping that up to the appropriate size seems to have done the trick. …

---

## [TCP echo server using "socket" module](https://erlangforums.com/t/tcp-echo-server-using-socket-module/2301)

<div class="topic-metadata">

**Author:** [@zabrane](https://erlangforums.com/u/zabrane)\
**Replies:** 1\
**Last updated:** [January 23, 2023, 1:15am UTC](https://erlangforums.com/t/tcp-echo-server-using-socket-module/2301 "2023-01-23T01:15:39Z")

</div>

Hi guys, I must be missing something, but I’m unable to make an echo server using socket module, which is faster than the old gen\_tcp. Whatever I tried, plain old gen\_tcp is still faster. % https://github.com/treadup/…

---

## [Allow socket:socket\_option() in gen\_tcp when inet\_backend == socket](https://erlangforums.com/t/allow-socket-socket-option-in-gen-tcp-when-inet-backend-socket/2105)

<div class="topic-metadata">

**Author:** [@RoadRunnr](https://erlangforums.com/u/RoadRunnr)\
**Replies:** 2\
**Last updated:** [December 7, 2022, 2:08pm UTC](https://erlangforums.com/t/allow-socket-socket-option-in-gen-tcp-when-inet-backend-socket/2105 "2022-12-07T14:08:24Z")

</div>

The socket module as much more complete, cross platform support for advanced socket options. It would be useful if those options could be used in gen\_tcp’s connect and listen methods. Currently, only the raw options is …

---

## [Unable to bind\_to\_device](https://erlangforums.com/t/unable-to-bind-to-device/2080)

<div class="topic-metadata">

**Author:** [@rychale](https://erlangforums.com/u/rychale)\
**Replies:** 1\
**Last updated:** [November 28, 2022, 6:55am UTC](https://erlangforums.com/t/unable-to-bind-to-device/2080 "2022-11-28T06:55:25Z")

</div>

Hello, Trying to set SO\_BINDTODEVICE flag on a socket like: iex(8)\> :gen\_tcp.connect({8, 8, 8, 8}, 53, \[inet\_backend: :socket, bind\_to\_device: 'ens3', active: false\]) \*\* (exit) :badarg (kernel 8.5.1) gen\_tcp\_socket…

---

## [Packets are mixing in socket's queue](https://erlangforums.com/t/packets-are-mixing-in-sockets-queue/1910)

<div class="topic-metadata">

**Author:** [@Abdelghani](https://erlangforums.com/u/Abdelghani)\
**Replies:** 5\
**Last updated:** [October 6, 2022, 5:54am UTC](https://erlangforums.com/t/packets-are-mixing-in-sockets-queue/1910 "2022-10-06T05:54:43Z")

</div>

Hello everyone, Iam so tired from triying understanding what’s going into my program, I have a gen\_statem server and a gen\_statem client that should communicate, first the client send some data to the server and waits f…

---

## [New socket vs inet driver - any recent benchmarks that show any expected performance gains?](https://erlangforums.com/t/new-socket-vs-inet-driver-any-recent-benchmarks-that-show-any-expected-performance-gains/1809)

<div class="topic-metadata">

**Author:** [@nhpip](https://erlangforums.com/u/nhpip)\
**Replies:** 3\
**Last updated:** [September 4, 2022, 11:56am UTC](https://erlangforums.com/t/new-socket-vs-inet-driver-any-recent-benchmarks-that-show-any-expected-performance-gains/1809 "2022-09-04T11:56:55Z")

</div>

Hi, I’m considering upgrading to use the new socket implementation for a cloud based deployment that consumes and emits lots of TCP traffic. I was wondering if there are any recent benchmarks that show any expected per…

---

## [Performance of socket option {packet, 4}](https://erlangforums.com/t/performance-of-socket-option-packet-4/1562)

<div class="topic-metadata">

**Author:** [@ansd](https://erlangforums.com/u/ansd)\
**Replies:** 4\
**Last updated:** [June 22, 2022, 2:21pm UTC](https://erlangforums.com/t/performance-of-socket-option-packet-4/1562 "2022-06-22T14:21:01Z")

</div>

Hey, In rabbitmq-server PR #5054 I switched from socket option {packet, 0} to socket option {packet, 4} for the RabbitMQ stream protocol. My expectation was to get a speedup since packet parsing will be done by the Erl…

---

## [Exit without close leaks socket?](https://erlangforums.com/t/exit-without-close-leaks-socket/1398)

<div class="topic-metadata">

**Author:** [@zuiderkwast](https://erlangforums.com/u/zuiderkwast)\
**Replies:** 3\
**Last updated:** [May 6, 2022, 7:04am UTC](https://erlangforums.com/t/exit-without-close-leaks-socket/1398 "2022-05-06T07:04:28Z")

</div>

Hello. Correct me if I’m wrong, but when a process with a gen\_tcp connection exits, the socket is not automatically closed, e.g. no TCP RST nor FIN is sent to the peer. What are the implications of this? The peer thinks…

---

## [How to change owner of TCP socket](https://erlangforums.com/t/how-to-change-owner-of-tcp-socket/1181)

<div class="topic-metadata">

**Author:** [@mmin](https://erlangforums.com/u/mmin)\
**Replies:** 5\
**Last updated:** [March 9, 2022, 8:21am UTC](https://erlangforums.com/t/how-to-change-owner-of-tcp-socket/1181 "2022-03-09T08:21:01Z")

</div>

Hi, I’m having trouble with changing the owner of the TCP socket. I tried inet:tcp\_controlling\_process/2 and gen\_tcp:controlling\_process/2 and they return ‘ok’, but when the previous controlling proces dies, i receive ‘t…

---

## [Erlang socket module concurrent operations](https://erlangforums.com/t/erlang-socket-module-concurrent-operations/1172)

<div class="topic-metadata">

**Author:** [@meox](https://erlangforums.com/u/meox)\
**Replies:** 0\
**Last updated:** [March 5, 2022, 8:12am UTC](https://erlangforums.com/t/erlang-socket-module-concurrent-operations/1172 "2022-03-05T08:12:51Z")

</div>

Reading the doc of the Erlang socket module Erlang -- socket is not clear for me if we can call sendto & recvfrom from different process currently. It’s reported that: The intent is that it shall be as "close as possibl…
