[erlang-questions] gen_tcp issue when socket interrupted by peer

Loïc Hoguin essen@REDACTED
Sat Feb 9 20:30:37 CET 2013


On 02/09/2013 03:08 PM, Morgan Segalis wrote:
> Hi everyone,
>
> I'm facing an issue when the client wrongly interrupt the connection to the server...
>
> Actually, the client is a phone... When the phone goes from Wifi to (3G or No Connection) the tcp connection opened while it was on Wifi is still opened on the server.
>
> The weird thing is, If I send data to the "closed" socket, gen_tcp:send returns always ok, although it will never been received...
> I though that TCP was all about stability and message receiving (unlike UDP).

TCP isn't perfect there, there can be cases where the socket is closed 
on one side and the other doesn't know. This can be solved by a timeout. 
I wasn't expecting sends to still succeed though.

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list