[erlang-questions] tcp_closed message

Boshan Sun sunboshan@REDACTED
Thu Feb 21 19:43:36 CET 2019


Here's a really simple repo to demonstrate the usage of gen_tcp/gen_udp.
https://github.com/sunboshan/socket

You can follow the tcp.erl to use gen_tcp to set up a server, then use
gen_tcp to connect to the server as a client. When one end disconnect, the
other end will simply get a {tcp_closed, Socket} message. Nothing more than
that.

Boshan

Justin Wood <justin.k.wood@REDACTED> 于2019年2月21日周四 上午10:24写道:

> Hello,
>
> I have a situation where I am closing a gen_tcp/gen_udp socket within my
> Erlang application. However, I would really like it to act as if it were
> disconnected or closed from the other end. Basically I want the
> {tcp_closed, S} message to be sent to the controlling process.
>
> A simple solution would be to just send the message myself. I'm just not
> sure if that would have the exact same behaviour (there is probably more to
> it than just the closed messed) as if the socket were truly disconnected or
> closed from the other end.
>
> Justin
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190221/4a226e63/attachment.htm>


More information about the erlang-questions mailing list