> so, non-blocking socket
> select says the socket is ready for read, but recv returnes 0 - this
> means connection closed or this is some error?
It means connection closed.
Some servers accept and then immediately close connections depending
on some given condition. For example, a server may refuse to accept a
connection from a particular IP address, or from anything not on the
local subnet. You'd have to check to see if the server you're
connecting to is doing something like that.
Quote:> before calling recv one success 'send' is done
Sending one buffer will not tell you anything like that really. A good
return only means that the buffer was successfully copied to the TCP
send queue. It doesn't mean that the data were sent or received.
A second or subsequent send (hard to predict how many you'd have to
do) would return -1 with ECONNRESET.
Quote:> if it is connection failed - shoud the socjet be SET in exceptions
The exception set is not to indicate errors, even though man pages and
even SUS says it does. It indicates that an urgent message is pending.
I believe the socket programming FAQ gives a better explanation of
stuff like this: