Results 1 to 3 of 3

Thread: connection reset problem

  1. #1

    connection reset problem

    I am getting a socket error while trying to send a sequence of strings to a server I created. Im useing Winsock as I am programing in Windows.

    the error returned by WSAGetLastError was number 10054:

    #define WSABASEERR 10000;

    Which acording to google indicates a connection reset. Obviously this must mean my server is not receiving the data.

    I have an array of pointers:

    char *list[6];

    and my server loops 6 times and each time it assignes the data retrived into a buffer, and then into my array.

    The client simply loops 6 times each time asking for a string and sending it.

    This way my theory is I will be able to pass a array of pointers from my client to the server.

    the client sucessfully sends 3 strings, then I get the error reported by my error handler.

    Acording to http://www.innovation.ch/java/HTTPClient/errors.html

    java.net.SocketException: Connection refused
    (connecting to the local host) The server is not running (nobody is listening on the specified port).

    I am programing in C but would assume that this error is global and would apply to all languages.

    I have verified with my firewall status that before the error the server is indeed listeining, and conected in, and the client is conected out.

    After the error ocures, my client window closes,.

    Are there any typical causes of connection reset?

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Connection reset will typically happen if whatever's on the other end of the connection goes away unexpectedly - typically resulting from a modem hangup, machine reboot or simply a network problem that persists long enough to reset the connection.

    Another common cause (these days) is a connection which has been timed out by an intervening NAT firewall - usually when no traffic has been sent for a while.

    As TCP connections don't usually send keep-alives by default, you may get this error when trying to send a message down the socket. This is completely normal, your code should handle it the same as if the client had hung up.

    When writing something to be used over the internet, these connection resets are very common - your application should be able to handle them robustly on both the client and server end - the server should assume the client has gone away, the client may wish to try reconnecting - or prompt the user to reconnect.

    In some protocols, the server will keep a "disconnected" session active for a while, in case the client decides to reconnect following a broken connection. For online games etc, this allows a conn reset to be handled without abandoning the game.

    To attempt to avoid this problem, keep-alives can be enabled. I don't know how to do this but I'm sure it can be found out easily.


  3. #3
    Thank you, I will find out how to enable keep alive so my server does not reset the conection.

    My error handler so far only prints the error number to the screen and shutsdown winsock.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts