I think you should also look into setting linger options at a lower rate than present values. 120 seconds is too long. 15-30 seconds is a reasonable amount of time to give a dead socket.
In fpc componetent design, I would recommend to also make sure that sockets issue SHUT_DOWN for Both read and write before issuing close. The poster's problems are infact, common linux behaviour, and can lead to permant socket non-resuabiltily if the kernel does not get the shutdown and/or close / and linger is not set. Since most kernel developers EXPECT users to close their sockets properly. On Fri, Oct 14, 2011 at 8:53 AM, Vladimir Zhirov <vvzh.li...@gmail.com> wrote: > Hi, > > Currently, if THTTPApplication-based program on Linux was > stopped manually during active connection I cannot > start it again for 1-2 minutes, getting the exception > like this: >> exception at 0805304A: >> Binding of socket failed: 8080. > > According to > http://stackoverflow.com/questions/3229860/what-is-the-meaning-of-so-reuseaddr-setsockopt-option-linux > setting SO_REUSEADDR option for server socket of embedded > fcl-web server would allow to restart the application > immediately after shutdown. > > I wonder what is the proper way of implementing this option: > > 1) Should the setter code go to fcl-net's ssockets.pp > and become "function TSocketServer.SetSocketOption"? > Or "property TSocketServer.ReuseAddress: Boolean"? > Or should I use fpSetSockOpt directly on > TSocketServer.Socket without changes to TSocketServer itself? > > 2) Should this option be hardcoded in > TFPCustomHttpServer.CreateServerSocket, or configurable via > TCustomHTTPApplication? > _______________________________________________ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel