[solved]winsock keep encounter 10053 error
-
hi, my code keep encounter the 10053 error when running in windows7 but works fine in winXP. what might be wrong? here is my code http://paste.ubuntu.com/7456583/ and here is the output: http://paste.ubuntu.com/7456610/ the error is always happens in the loop:
for (j=0;j<10000;j++) {
sprintf(buf,"%d,%d,%d\n",0,0,0);
sendall(sock,buf,strlen(buf),__LINE__);
readall(sock,buf,4,__LINE__);
n = *(int *)buf;
assert(n==4);
/*for (int ii=0;ii<n;ii++) {
readall(sock,buf,16,__LINE__);
}*/
readall(sock,buf,64,__LINE__);
std::cout<<"j= "<<j<<std::endl;
Sleep(1000);
}BTW, the server side will not close socket. UPDATE:I used wireshark to notice that the 10053 was caused by the TCP RST packet that was pushed to remote server by my client. The time that the RST packet was sent is always right after a packet received that contains 64 bytes I shall read at the end of the loop. But my code is never intended to do that. I'm stuck with this problem for days. Thanks.
-
hi, my code keep encounter the 10053 error when running in windows7 but works fine in winXP. what might be wrong? here is my code http://paste.ubuntu.com/7456583/ and here is the output: http://paste.ubuntu.com/7456610/ the error is always happens in the loop:
for (j=0;j<10000;j++) {
sprintf(buf,"%d,%d,%d\n",0,0,0);
sendall(sock,buf,strlen(buf),__LINE__);
readall(sock,buf,4,__LINE__);
n = *(int *)buf;
assert(n==4);
/*for (int ii=0;ii<n;ii++) {
readall(sock,buf,16,__LINE__);
}*/
readall(sock,buf,64,__LINE__);
std::cout<<"j= "<<j<<std::endl;
Sleep(1000);
}BTW, the server side will not close socket. UPDATE:I used wireshark to notice that the 10053 was caused by the TCP RST packet that was pushed to remote server by my client. The time that the RST packet was sent is always right after a packet received that contains 64 bytes I shall read at the end of the loop. But my code is never intended to do that. I'm stuck with this problem for days. Thanks.
-
Please do not expect people to download your code and diagnose your problem for you. Show the lines of code where the error occurs (not the entire program) and provide the complete error message associated with the error code.
-
hi, my code keep encounter the 10053 error when running in windows7 but works fine in winXP. what might be wrong? here is my code http://paste.ubuntu.com/7456583/ and here is the output: http://paste.ubuntu.com/7456610/ the error is always happens in the loop:
for (j=0;j<10000;j++) {
sprintf(buf,"%d,%d,%d\n",0,0,0);
sendall(sock,buf,strlen(buf),__LINE__);
readall(sock,buf,4,__LINE__);
n = *(int *)buf;
assert(n==4);
/*for (int ii=0;ii<n;ii++) {
readall(sock,buf,16,__LINE__);
}*/
readall(sock,buf,64,__LINE__);
std::cout<<"j= "<<j<<std::endl;
Sleep(1000);
}BTW, the server side will not close socket. UPDATE:I used wireshark to notice that the 10053 was caused by the TCP RST packet that was pushed to remote server by my client. The time that the RST packet was sent is always right after a packet received that contains 64 bytes I shall read at the end of the loop. But my code is never intended to do that. I'm stuck with this problem for days. Thanks.
This error may occur if the connection is blocked by a firewall or anti virus program. Because the error occurs with Windows 7 and not with XP, the probable source is the Windows 7 firewall. Configure your firewall(s) to allow traffic from/to the used protocol and port.
-
This error may occur if the connection is blocked by a firewall or anti virus program. Because the error occurs with Windows 7 and not with XP, the probable source is the Windows 7 firewall. Configure your firewall(s) to allow traffic from/to the used protocol and port.
Jochen Arndt wrote:
This error may occur if the connection is blocked by a firewall or anti virus program. Because the error occurs with Windows 7 and not with XP, the probable source is the Windows 7 firewall. Configure your firewall(s) to allow traffic from/to the used protocol and port.
thanks for your reply. I have disable my windows firewall and all my anti-virus program. The problem remains. And I noticed that my machine sends TCP RST packet right after receive 64bytes from remote server. The RST packet which causes the 10053 error is never intended in my code.
-
Jochen Arndt wrote:
This error may occur if the connection is blocked by a firewall or anti virus program. Because the error occurs with Windows 7 and not with XP, the probable source is the Windows 7 firewall. Configure your firewall(s) to allow traffic from/to the used protocol and port.
thanks for your reply. I have disable my windows firewall and all my anti-virus program. The problem remains. And I noticed that my machine sends TCP RST packet right after receive 64bytes from remote server. The RST packet which causes the 10053 error is never intended in my code.
The RST can be send by any device/software which is involved in the transmission including routers between client and server. Did you capture the RST at client or server side? You may install client and server on the same machine if possible and connect using the loopback interface. Such connections are usually not filtered by any software like firewalls. If the problem is then still there, it may be Windows 7 TCP stack specific. A useful link that goes into detail about RST packets: http://blogs.technet.com/b/networking/archive/2009/08/12/where-do-resets-come-from-no-the-stork-does-not-bring-them.aspx[^].
-
The RST can be send by any device/software which is involved in the transmission including routers between client and server. Did you capture the RST at client or server side? You may install client and server on the same machine if possible and connect using the loopback interface. Such connections are usually not filtered by any software like firewalls. If the problem is then still there, it may be Windows 7 TCP stack specific. A useful link that goes into detail about RST packets: http://blogs.technet.com/b/networking/archive/2009/08/12/where-do-resets-come-from-no-the-stork-does-not-bring-them.aspx[^].
Jochen Arndt wrote:
The RST can be send by any device/software which is involved in the transmission including routers between client and server. Did you capture the RST at client or server side?
You may install client and server on the same machine if possible and connect using the loopback interface. Such connections are usually not filtered by any software like firewalls. If the problem is then still there, it may be Windows 7 TCP stack specific.
A useful link that goes into detail about RST packets: http://blogs.technet.com/b/networking/archive/2009/08/12/where-do-resets-come-from-no-the-stork-does-not-bring-them.aspxThanks for your replay. I just found out that it is server side's fault. A java coder write the server side code which sends out one byte urgent message via java API function sendUrgentData() at the end of the loop, in order to detect whether the connect is open( this is a really bad method to do the detection). I asked he comment out this statement, than my code work fine!! It turns out it is the win7 network stack that sends out RST packet in response to seeing frequent urgent packet. I guess it is a new self-protection reaction introduced in win7. The same phenomenon is never observed in xp or linux.
-
Jochen Arndt wrote:
The RST can be send by any device/software which is involved in the transmission including routers between client and server. Did you capture the RST at client or server side?
You may install client and server on the same machine if possible and connect using the loopback interface. Such connections are usually not filtered by any software like firewalls. If the problem is then still there, it may be Windows 7 TCP stack specific.
A useful link that goes into detail about RST packets: http://blogs.technet.com/b/networking/archive/2009/08/12/where-do-resets-come-from-no-the-stork-does-not-bring-them.aspxThanks for your replay. I just found out that it is server side's fault. A java coder write the server side code which sends out one byte urgent message via java API function sendUrgentData() at the end of the loop, in order to detect whether the connect is open( this is a really bad method to do the detection). I asked he comment out this statement, than my code work fine!! It turns out it is the win7 network stack that sends out RST packet in response to seeing frequent urgent packet. I guess it is a new self-protection reaction introduced in win7. The same phenomenon is never observed in xp or linux.
Fine to here that you resolved the issue and posted the reason. It may be helpful for others.