[erlang-questions] Can gen_tcp:close() close a socket which is still sending?

Tony Rogvall <>
Mon Jun 15 09:52:27 CEST 2009


So what happens if you use shutdown write?
Use ethereal or tcpdump to get a trace!

/Tony


On 15 jun 2009, at 04.26, John Haugeland wrote:

> The client will not shut down.
>
> The issue is that, conceptually, what needs to happen is the server
> should provide a response then drop as soon as its response is
> completely dispatched.  Erlang is not waiting for the other side to
> close.  Erlang is completely in control here.  The desired behavior is
> solely guided by when that gen_tcp:send(...) is complete.
>
> It's a webserver.  The client doesn't close the connection.
>
>
>
>
>
> On Sun, Jun 14, 2009 at 4:48 PM, Tony Rogvall<> wrote:
>>
>> The "safe" way to terminate a sending socket is to use shutdown(S,  
>> write)
>>
>> and then wait for the server side to close the connection.
>>
>> This here may be exactly what I need to know.  To check, first,
>> though: in context, erlang _is_ the server side.  Does that change
>> things?  The client is any web browser.  I apologize for having been
>> unclear.
>>
>>
>>
>> Then perhaps you should check the exit_on_close option in the inet  
>> module.
>> If the client uses shutdown you will be able to write data to the  
>> client and
>> then close after this is done.
>> /Tony
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>



More information about the erlang-questions mailing list