send() hangs..not select()

I did more debugging, it wasn’t the select() function that hangs…it’s the
send(), is there a way
to check the socket state before calling send()?

I don’t think ‘hangs’ is the right word. It’s probably
trying to send the data and the send buffer is full, so
it blocks until some of it drains. tcp is a reliable
protocol so it is persistent about trying to send data.
It will retry 12 times over an approximately 9 minute
period before droping the connection. If you don’t
like this, you can set the socket to nonblocking:
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
in which case the send will fail immediately with
EWOULDBLOCK or you can set a smaller timeout via
timer_timeout() before calling send().

-seanb

ran zhang <rzhang@vamcointernational.com> wrote:
: I did more debugging, it wasn’t the select() function that hangs…it’s the
: send(), is there a way
: to check the socket state before calling send()?