Re: Howto reset and reuse a socket (not having a 7.80 sec delay)

From: Andrei Voropaev (avorop_at_mail.ru)
Date: 06/09/05


Date: 9 Jun 2005 08:19:34 GMT

On 2005-06-08, Troels Smit <troels_smit@hotmail.com> wrote:
> Hi,
>
> Im writing a client/server application using c++ socket on linux.
> The clients must be able to reconnect to the server in an efficient
> manner.
>
> The server is receiving data from the client.
> The client is transmitting about 50% of the time in 200ms intervals.
>
> My problem occur when I reset the client.
>
> If the client is not transmitting when I reset it, the server will not
> do anything until the client re-connects. When the client re-connects
> the new connection is accepted and the old connection closed. This is
> fine and progresses very fast.
>
> Now, if the client IS transmitting when I reset it, the server will
> receive a "Connection reset by peer" and close the connection. When
> the client then re-connects exactly 7.80 seconds!! will pass before
> data starts to flow. The connections is accepted (so the new
> connection is immidiately seen by the server) but the second packet
> will not be received at the server, before 7.80 seconds has passed,
> then everything again runs in a smooth manner.
>
> I have set the socket options "REUSE" and "LINGER". Where Linger is
> set in aboard mode so the old tcp-connection should be immidiately
> terminated.
>
> Any ideas ?

No ideas. It's the problem of your server and not of the socket. Or
maybe it is the problem of your client. Post the code, maybe someone
will point it out for you. Usually you never should use SO_LINGER,
unless you know exactly what you are doing (it is not your case).

Also try to get the Stevens book "Unix Network Programming" and learn
how to handle abnormal terminations of TCP connections (I assume you
pass data using TCP).

-- 
Minds, like parachutes, function best when open


Relevant Pages

  • Re: .Net Scalability problem
    ... LoadRunner will peak out a server with a few virtual users. ... To get an idea of load, ... Fire off the test client and watch the number of ... > So I think that the MTC generate concurrent connection and per ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Connection lost at same time every hour (sometimes)
    ... After making the two following alterations on the server the problem seems ... After analyze your ipconfig on SBS and client, ... Then, other connection is good, ...
    (microsoft.public.windows.server.sbs)
  • Re: server disconnection - very often
    ... Reason of permanent popups is VMware server aplication on clients. ... Run CEICW to configure the network of SBS: ... Two network adapters - manual router connection to broadband ... Uninstall VMware on client. ...
    (microsoft.public.windows.server.sbs)
  • Re: Lan setup 2 nic
    ... The external nic only has TCP/IP enabled. ... Ipconfig of the server is looking good, but the client is still missing the ... > connection so we have a 2 nic with router setup now. ...
    (microsoft.public.windows.server.sbs)
  • Re: Regular disconnections from remote web workplace
    ... I can connect to office server and all office clients from home at all times ... be physically working right up until the connection is lost. ... If I enter http://companyip from a client I receive the login screen for the ... Click Services tab and select Hide All Microsoft Services and Disable ...
    (microsoft.public.windows.server.sbs)