You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2003/10/16 17:29:03 UTC

closesocket() vs close()

Forwarded message:
>       * Bugz: #22805
>   -      Jim is working on a somewhat revised patch which also 
>   -      uses closesocket() universally (instead of the places
>   -      where we do #ifdef BEOS...). Only the changes to buff.c
>   -      are being considered at this time.
>   +       Jim is considering just the buff.c patches in addition
>   +       to cleanup of http_main.c where we wrap close/closesocket
>   +       around '#ifdef BEOS' which does not seem correct. Under
>   +       Unix, we define closesocket as close, and isn't closesocket
>   +       what we should be using for Win32 and Netware as well?
>    

Comments from the Win32 and Netware people??
-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

Re: closesocket() vs close()

Posted by gr...@apache.org.
>     Note that the semantics of the UNIX close as applied to
>     sockets differ from Win32's closesocket.  If you want to
>     emulate the UNIX close on Win32, there is more to it than
>     just calling closesocket.  Otherwise, visible data loss will
>     occur.
> 
>     Relevant MSDN quote[1]
> 
>         "To assure that all data is sent and received on a
>         connection, an application should call shutdown before
>         calling closesocket (see Graceful shutdown, linger
>         options, and socket closure[2] for more information).

why is that different from Unix?  I thought this was a TCP protocol thing, i.e., 
you should do shutdown() before closing a socket on any platform to insure no 
data loss.

Greg


Re: closesocket() vs close()

Posted by Sascha Schumann <sa...@schumann.cx>.
On Thu, 16 Oct 2003, Jim Jagielski wrote:

> Forwarded message:
> >       * Bugz: #22805
> >   -      Jim is working on a somewhat revised patch which also
> >   -      uses closesocket() universally (instead of the places
> >   -      where we do #ifdef BEOS...). Only the changes to buff.c
> >   -      are being considered at this time.
> >   +       Jim is considering just the buff.c patches in addition
> >   +       to cleanup of http_main.c where we wrap close/closesocket
> >   +       around '#ifdef BEOS' which does not seem correct. Under
> >   +       Unix, we define closesocket as close, and isn't closesocket
> >   +       what we should be using for Win32 and Netware as well?
> >
>
> Comments from the Win32 and Netware people??

    Note that the semantics of the UNIX close as applied to
    sockets differ from Win32's closesocket.  If you want to
    emulate the UNIX close on Win32, there is more to it than
    just calling closesocket.  Otherwise, visible data loss will
    occur.

    Relevant MSDN quote[1]

        "To assure that all data is sent and received on a
        connection, an application should call shutdown before
        calling closesocket (see Graceful shutdown, linger
        options, and socket closure[2] for more information).

    [1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/closesocket_2.asp
    [2] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/graceful_shutdown_linger_options_and_socket_closure_2.asp

    - Sascha