[erlang-questions] Finding closed socket

Christian S chsu79@REDACTED
Mon Oct 16 18:12:33 CEST 2006


This is a common problem and the solution is a bit of a "pattern":

Use ping messages in your protocol to see that the other end is still
there. I.e. modify your protocol so it has a "noop" ping-pong
request-reply.

TCP keepalives are almost unusable since the interval between
keepalives is often unusably long, and OS implementations of tcp
stacks do typically not allow  you to change this on a per-socket
level, instead it is OS-global.

PS. Come to think of it. Is this still true and why do we accept it?
Gosh BSD-socket interface is lame. I want keepalives sent to my socket
controller process!

On 10/16/06, Surindar Sivanesan <surindar.shanthi@REDACTED> wrote:
> Dear all,
>
> I have client server application.
> If network cable is unplugged at the client PC, the server is not able to
> detect the communication breakage.
> I have given
> gen_tcp:listen(Port,[{active,false},{packet,0},{keepalive,true}])
>  in the server.
> If any option is available to detect it at the server end, it will be very
> useful to me.
> Thanks in advance!
> --
> with regards,
> S.Surindar
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
>



More information about the erlang-questions mailing list