Link to home
Start Free TrialLog in
Avatar of learningunix
learningunix

asked on

socket error

In my logs I see many "system error 104" during TCP send() which I am sure mostly likely connection was lost by server and serve is still trying to send the data.

However once in a while I do see "system error 32" also during send()
what could be the reason for sys error 32?  I am trying to chase an issue and just wanted to understand the socket behavior
Avatar of Infinity08
Infinity08
Flag of Belgium image

Assuming that this is Linux, you can use perror to get a more human readable error message for these error codes.

You'll get something like "Connection reset by peer" for errno 104 (ECONNRESET), and "Broken pipe" for errno 32 (EPIPE).

In the context of a send, ECONNRESET means that the remote end (peer) closed the connection, sending a reset. And EPIPE means that the socket doesn't allow writing, or is not connected (both usually have local causes).
Avatar of learningunix
learningunix

ASKER

Under what circumstance would socket not allow to write and fail with EPIPE?  is it because the socke is full? or something else?
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> The solution is to implement  a handshake so that the socket is not closed until you receive an acknowledgement about the receipt of the message from the other end.

?? TCP already does that for you.
Thx