[erlang-questions] tcp connection with timeout

kamiseq kamiseq@REDACTED
Fri Oct 16 19:07:43 CEST 2009


hi,
it is all true, but if I am working with the server that only listen to one
client and is responding to its requests and if I am able to set send_timout
to some value then after this time I expect that I will not get any response
form the server no matter what so I can execute some logic, try other
request or repeat action or shut down or whatever.

2009/10/14 Bernard Duggan <bernie@REDACTED>

> kamiseq wrote:
> > hi,
> > is there a way to discard any message from peer after set timeout occurs?
> A
> > server should respond in given time or transmission should be repeated.
> >
> > I implemented small ex where one process is listening and responding in
> > random time (let say 1 to 3 sek). and it is always accepting exactly one
> > process during its life.
> >
> I'm not entirely sure what you mean by "accepting exactly one process".
> > other process is connecting via tcp and is sending msg. I set
> send_timeout
> > flag for socket and a timer on receive after to let say 500ms and 1000ms
> so
> > it should get timeout all the time.
> >
> send_timeout does not do what you seem to think it does.  The
> acknowledgement of the send is generated by the far end's TCP stack
> before your code ever sees the packet.
> > when I receive timeout I send special msg that server should repeat last
> > response. all this is great but then I will receive two responses from
> > server with timeouted and then repeated msg.
> >
> > in fact Im receiving all "lost" messages that were sent to my client by
> > server. I could maybe add some ticket to the msg and take out any
> incoming
> > messages that are not matching but this is impossible right now (afac) as
> I
> > will break protocol.
> >
> I think your basic problem here is that you're using TCP, but trying to
> re-implement part of it (lost/timed-out message retransmission) on top
> of it.  If you want to tinker with stuff at that level, use a UDP
> connection instead.
>
> Cheers,
>
> Bernard
>
>


-- 

pozdrawiam
Paweł Kamiński

kamiseq@REDACTED
pkaminski.prv@REDACTED
______________________


More information about the erlang-questions mailing list