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

John Haugeland stonecypher@REDACTED
Mon Jun 15 04:26:28 CEST 2009


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<tony@REDACTED> 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


More information about the erlang-questions mailing list