Solved

socket error

Posted on 2011-03-06
6
562 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:learningunix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 35047062
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).
0
 

Author Comment

by:learningunix
ID: 35047882
Under what circumstance would socket not allow to write and fail with EPIPE?  is it because the socke is full? or something else?
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 400 total points
ID: 35048263
>> Under what circumstance would socket not allow to write and fail with EPIPE?

A common circumstance for this, is when the connection is in the process of being closed. The write half (sending half) can already be closed, but the read half (receiving half) not yet (waiting confirmation from the other end).

Read up on the TCP protocol for more specifics of how TCP connections are managed.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 12

Assisted Solution

by:trinitrotoluene
trinitrotoluene earned 100 total points
ID: 35051152
I've seen this happen before! First of all

32 maps to EPIPE - broken pipe

104 -  ECONNRESET connection reset by the peer

so if you are seeing this it is most definitely a case of closing either end of the socket before a send/recv has completed just as Infinity has suggested. 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.

Also see my solution in EE for a related problem
http://www.experts-exchange.com/Programming/Languages/CPP/Q_26557236.html
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 35053783
>> 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.
0
 

Author Closing Comment

by:learningunix
ID: 35060415
Thx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question