Version franēaise
Home     About     Download     Resources     Contact us    
Browse thread
Error binding socket
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] Error binding socket
Am Donnerstag, den 10.11.2005, 00:29 +1100 schrieb skaller:
> On Wed, 2005-11-09 at 13:33 +0100, Maurizio Colucci wrote:
> > Hi there. For my free tennis game (http://freetennis.sf.net), I get an
> > error binding the socket to a port. (Unix_error 50, "bind"). The error
> > description is "address already in use".
> > 
> > This error only happens the *second* time I start the program. It is
> > as if the port had not been freed and were still in use. The system is
> > GNU/Linux Ubuntu Breezy.
> > 
> > However, if I wait about 1minute, or I start the program specifying a
> > different port, the problem does not happen. It is as if Linux were
> > freeing the port with a delay.
> 

>        SO_LINGER

Usually you need lingering only if the server socket closes the
connection (fully) and wants to be sure everything is transmitted to the
client. Only very few protocols need this.

Gerd

>               Sets or gets the SO_LINGER option. The argument is a
> linger structure.
> 
>               struct linger {
>                   int   l_onoff;    /* linger active */
>                   int   l_linger;   /* how many seconds to linger for */
>               };
> 
>               When enabled, a close(2) or shutdown(2) will not return
> until  all  queued  mesā€
>               sages  for the socket have been successfully sent or the
> linger timeout has been
>               reached. Otherwise, the call returns immediately and the
> closing is done in  the
>               background.   When the socket is closed as part of
> exit(2), it always lingers in
>               the background.
> 
> 
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Telefon: 06151/153855                  Telefax: 06151/997714
------------------------------------------------------------