TCP server does not detect the client network failure

From: Mariya (mariya.k_at_gmail.com)
Date: 07/31/04

  • Next message: Matthew: "Re: JAVAMAIL SMTP error 421"
    Date: 30 Jul 2004 17:48:06 -0700
    
    

    Hi,

    This is a behavior of the TCP socket in Java I dont' understand:.
    Let say we have a simple client/server application running on TWO different
    machines.
    The client send bytes to the server.
    The server recieved the bytes and wait for about X sec.
    During this waiting time, we disconnect the server from the network (just by
    unplugging the server network cable).
    After the waiting time the server is aware of the network failure (a
    SocketException is thrown : connection reset, because it is trying to send
    the response)
    But on the client side it is still stuck on a "rcv =
    commandInput.readLine();" statement (see after for the complete code), it
    will never be aware of the network failure !!! Even after one hour the
    client is still waiting to read something on a closed socket. Is this the
    normal behavior ?

    In reality we are dealing with an application that use the FTP server to
    server mode (we are controlling only the command socket, the data transfer
    is made by the servers). We have to transfer huge files, thus we can not set
    up a time out. If the last scenario occurs, some of our transfers are stuck
    and it is not possible for us to detect the failure. The client will wait
    for ever the response.

    Does anybody have already deal with that


  • Next message: Matthew: "Re: JAVAMAIL SMTP error 421"

    Relevant Pages

    • Re: Socket switch delay
      ... both at the client and at the server (and why ... would you set the send buffer size to zero on a non-overlapped ... One glaring error is your client does ... So when you use a single socket, ...
      (microsoft.public.win32.programmer.networks)
    • Re: Locking on async calls
      ... you must synchronize the entire SendMessage routine as an atomic ... operation to prevent mixed messages from being transmitted to the server. ... You are correct that read and write on the socket do not interfere with each ... If you want to handle multiple client connections from one server object ...
      (microsoft.public.dotnet.general)
    • Re: Design issue with WinSock/GetQueuedCompletionStatus
      ... delegate that to a shutdown routine called after all worker threads ... The application I've created is a server accepting connections on a few ... different TCP/IP ports and then lets the client run different commands. ... a TCP/IP socket can be closed for 2 different reasons: ...
      (microsoft.public.win32.programmer.networks)
    • Re: socket communication: socket doesnt connect
      ... Microsoft MVP, MCSD ... As far as your server code goes, ... accept the listening socket. ... Client client = new Client; ...
      (microsoft.public.vc.language)
    • Re: TCP server stop receiving new connections
      ... reset the event mask of your listening socket each time you ... I have a strange problem in my class library used by all our client ... server applications. ... incomming connections, but keeps current connections. ...
      (microsoft.public.win32.programmer.networks)