[erlang-questions] Finding closed socket

Surindar Sivanesan surindar.shanthi@REDACTED
Tue Oct 17 07:19:10 CEST 2006


Hi
Server and client are communicating.
Then i disabled the network at client PC. The client application returns
{error,econnreset}.
Nothing is triggered at server side.
Then i send a message from server to client but the gen_tcp:send result is
returned as 'ok' instead of '{error,Reason}'.

On 10/16/06, Christian S <chsu79@REDACTED> wrote:
>
> 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
> >
> >
> >
>



-- 
with regards,
S.Surindar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20061017/13fcc3cb/attachment.htm>


More information about the erlang-questions mailing list