Help socket connect timeout issues, urgent !!!!!!!
September 1, 2011
important reminder: The system detects that your account may have stolen the risk, please see the risk warning as soon as possible, and immediately change your password. Close
Netease blog security alert: The system detected that your current password is less secure, for your account security, we recommend that you change your password immediately amend the timely closure
Help socket connect timeout issues, urgent! ! ! ! ! ! ! Strong> strong>
2011-09-01 01:28:01Category: Default CategoryTags:Subscribe to help medium and small font size socket connect timeout issues, emergency ! ! ! ! ! ! ! Hello, everyone, early name for chinaunix have heard, they often search for information on this, I point at the socket communication problems encountered, would like to ask next.
hardware platform: ARM9
software level control of network traffic problems TC units: ECOS network protocol stack (FreeBSD)
problem description:
two boards, one to run TCP socket Server (accept), a running TCP socket Client (connect), have access to a large network environment (the same floor of the local area network), a special issue of data, a special data collection, communication time can only be continued for several hours, and then there “BrokenPipe” and “ConnectResetByPeer” error, send, recv function returns -1 to quit. Then when I wanted to be an error in the program automatically re-connect them and then send and receive, that is, Client: the first close (sk), re-socket, connect, and Server-side has been a task accept, the results of the phenomenon is several times before re-connection process Client is to connect several times or ten times (the middle range of the delay time) to connect to later (a few hours later), both also Rom on how the ( TCP three-way handshake is not successful), tried many methods will not work (l_onoff = 1; l_linger = 0, and so on). Ecos connect later found under 7 seconds time-out, and found that regardless of the ARP request packet capture or TCP SYN, the two sides of the response is very slow (I do not know why), more than ten seconds after the other only reply is often a matter, so connect it is also not normal.
connect it to change the timeout, a common method: Set non-blocking socket, connect, set time, select., can be written to determine whether, getsockpot, but I find the value of time within the 7s are in effect, more than 7 seconds, are 7s, when select returns, in the ecos library is also looking for clues to no avail (probably does not even know)
problem is how to make connect timeout is greater than 7 seconds, and discussing it … we help to see what approach did not, thank you, my code is as follows http://dok77.xdq.gov.cn:
[code]
int skhttp: / / essvi.ballet.org.cn, ret;
struct timeval tv;
fd_set rdevents , wrevents;
if ((sk = socket (AF_INET, SOCK_STREAM, 0)) <0)
{
perror ("Socket build fail \ n ");
return ERROR;
}
if (ioctl (sk, FIONBIO,
Posted: January 7th, 2012
at 7:46am by admin
Tagged with brokenpipe
Categories: Uncategorized
Comments: No comments













