[erlang-questions] tcp connection with timeout

Bernard Duggan <>
Mon Oct 19 07:20:47 CEST 2009


kamiseq wrote:
> 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
You expect wrong.  As I said before, the send_timeout only deals with
the time taken to receive an ACK from the server-side's TCP stack - it
has nothing to do with the application-level response your server code
may or may not decide to send back.  Think about it: Erlang knows
nothing about your application protocol, so how does it know that any
particular incoming TCP message is an application-level ACK to the one
you sent?

If you want to implement a timeout for the receipt of an
application-level message, you need to do that yourself using something
like timer:send_after(), and make sure you discard any responses
received after that timeout.

B



More information about the erlang-questions mailing list