Winsock error 10004 on UDP Socket ReceiveFrom

E

Erik Tamminga

Hi,

(.NET Framework 2.0 on Windows 2003 SP1)

I'm getting lots of 10004 WSAEINTR errors when I try to do some UDP
communication. From a packet capture I learned that my application is
responding with an ICMP Port Unreachable after the remote responds to my
query.

Example:
Me -> Remote: UDP request (valid request)
Remote -> Me: UDP response (valid response)
Me -> Remote: ICMP Port Unreachable (with a copy of the response
attached to the ICMP message)

Port numbers do match, so do my payload sequencenumbers.

My basicly code looks like this (removed irrelevant code):

socket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
socket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, timeout);
bytesSend = socket.SendTo(buf, remoteEp);
bytesReceived = socket.ReceiveFrom(inData, inData.Length,
SocketFlags.None, ref sendingHost);
socket.Close();

I get the 10004 error once every 50 requests (could be more or lesss), all
other requests succeed without errors.

Can someone give me some more insight in why I am getting the WinSock 10004
errors?
I've attached the class which is causing the problems. The method in
question is called ExecRequest().

Regards,
Erik Tamminga
 
P

Peter Duniho

[...]
I get the 10004 error once every 50 requests (could be more or lesss),
all
other requests succeed without errors.

Can someone give me some more insight in why I am getting the WinSock
10004
errors?

In this newsgroup, of the people who reply to network-related questions, I
am probably one of the more knowledgeable about that particular topic.

Which is bad news for you, because I don't really know that much. :)

If I were you, I would try leaving out the receive timeout and see if that
makes the problem go away. Socket timeouts aren't, IMHO, all that useful
because they can be just as easily and more reliably implemented in your
own code, and they can cause i/o errors when there was otherwise no reason
for one to occur.

But if that doesn't fix the problem, you should probably try a different
newsgroup, one more specific to network questions. For Winsock issues
(which this is nominally), the alt.winsock.programming newsgroup is a good
choice. There is also at least one newsgroup that specifically targets
TCP/IP (it has "tcpip" in the name, but I don't recall off the top of my
head the actual newsgroup name). In such a newsgroup, you'll find people
much more knowledgeable and conversant on the topic than you will here,
generally speaking.

For what it's worth, for UDP an error rate of 2% doesn't sound all that
high to me. :) Though, I guess it depends on the network. On a small
LAN, that might be considered high, I suppose.

Pete
 
E

Erik Tamminga

Peter,

Thank you. I'll continue my search...

I tried leaving out the timeout, but that didn't solve the problem. As a
packet capture showed me that the server IS receiving the response to the
request the software is to blaim not processing it and responsing with an
icmp port unreachable. The network performs perfectly.

Erik

Peter Duniho said:
[...]
I get the 10004 error once every 50 requests (could be more or lesss),
all
other requests succeed without errors.

Can someone give me some more insight in why I am getting the WinSock
10004
errors?

In this newsgroup, of the people who reply to network-related questions, I
am probably one of the more knowledgeable about that particular topic.

Which is bad news for you, because I don't really know that much. :)

If I were you, I would try leaving out the receive timeout and see if that
makes the problem go away. Socket timeouts aren't, IMHO, all that useful
because they can be just as easily and more reliably implemented in your
own code, and they can cause i/o errors when there was otherwise no reason
for one to occur.

But if that doesn't fix the problem, you should probably try a different
newsgroup, one more specific to network questions. For Winsock issues
(which this is nominally), the alt.winsock.programming newsgroup is a good
choice. There is also at least one newsgroup that specifically targets
TCP/IP (it has "tcpip" in the name, but I don't recall off the top of my
head the actual newsgroup name). In such a newsgroup, you'll find people
much more knowledgeable and conversant on the topic than you will here,
generally speaking.

For what it's worth, for UDP an error rate of 2% doesn't sound all that
high to me. :) Though, I guess it depends on the network. On a small
LAN, that might be considered high, I suppose.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top