gen_tcp:recv - last segement when closed port

Per Hedeland hedeland@REDACTED
Sat Mar 11 11:47:57 CET 2006


jmT2 <johan@REDACTED> wrote:
>
>I have a problem using gen_tcp:recv(Socket, 0). If (when as it turns out  
>in my application) the server port closes  the last segment is never  
>returned. Using Ethereal I can see the last TCP packet containing 1199  
>byts, but the last segement returned by recv/2 is as usual 1024 bytes. The  
>remaining 175 bytes is never found. The next call to recv/2 will only  
>return {error, closed} :-(

Hm, what's "usual" about 1024 bytes? Are you sure you aren't actually
doing gen_tcp:recv(Socket, 1024)? In that case what you see is the
documented behaviour. See also the thread starting at:
http://www.erlang.org/ml-archive/erlang-questions/200506/msg00116.html

--Per Hedeland



More information about the erlang-questions mailing list