Re: Recv(), determining connection closed or broken

From: Umpa (_at_umpaumpalala.com)
Date: 05/18/04

  • Next message: Andrei Voropaev: "Re: Recv(), determining connection closed or broken"
    Date: Tue, 18 May 2004 10:25:12 +0200
    
    

    > If your side knows that the other side closed the connection normally,
    > 'recv' will return zero. If your side knows that an error has occured
    > (either locally or on the other side), 'recv' will return '-1' and 'errno'
    > will tell you want happened.
    >
    Here are errnos matched to recv():

    EBADF
    The argument s is an invalid descriptor.

    ECONNREFUSED
    A remote host refused to allow the network connection
    (typically because it is not running the requested service).

    ENOTCONN
    The socket is associated with a connection-oriented protocol
    and has not been connected (see connect(2) and accept(2)).

    ENOTSOCK
    The argument s does not refer to a socket.

    EAGAIN
    The socket is marked non-blocking and the receive operation would
    block, or a receive timeout had been set and the timeout expired before
    data was received.

    EINTR
    The receive was interrupted by delivery of a signal before any
    data were available.

    EFAULT
    The receive buffer pointer(s) point outside the process's address space.

    EINVAL
    Invalid argument passed.

    Please, do tell me what errno is set to when connection
    is broken during receiving ? Personally, I can`t see any.

    How about this:
    http://groups.google.pl/groups?q=recv+connection+broken&hl=pl&lr=&ie=UTF-8&s
    elm=3dcb2b2b%241_3%40corp.newsgroups.com&rnum=5

    Umpa.


  • Next message: Andrei Voropaev: "Re: Recv(), determining connection closed or broken"