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

Morgan Segalis <>
Sat Feb 9 21:10:14 CET 2013


Yeah,

I was surprised too...
After some research, I have found this article that assume what I though, it is not an Erlang specific issue, but TCP...

http://blog.gerhards.net/2008/05/why-you-cant-build-reliable-tcp.html

... So I'll do my app-level ACK.

Le 9 févr. 2013 à 20:30, Loïc Hoguin a écrit :

> 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