UDP Socket Timing Out?

  • Thread starter Thread starter Tom Kent
  • Start date Start date
T

Tom Kent

I'm not a huge expert on UDP or sockets, so I was hoping someone could help
me out.

I have a C# app that sends three large (3KB) unicast datagrams out at user-
defined intervals (when they push a button) so this can happen every couple
seconds or every several minutes. Anyway, every time the application sits
for a few minutes and then the user tries to send, the first of the three
datagrams does not get to the recipiant. However, the socket does not
error and indicates that the correct number of bytes was sent.

I believe this also happens the first time after I startup. However, it
doesn't seem that re-starting the application changes the situation. (I
can restart and hit send within a few seconds and all three get through).

I'm not sure what other data would be useful in figuring this out, let me
know if there's anything important I'm missing.

Thanks!
Tom

P.S. Does the SetSocketOption KeepAlive have anything to do with this? I
was only able to find examples of it being used with TCP.
 
You are aware, no doubt, that UDP does not guarantee delivery. You need TCP
for that (which does a handshake). UDP just throws the packet out there and
always indicates that it was sent. But you have to write your own handshake
mechanism and resend to guarnatee delivery (there are many papers on this).
 
Yeah, I was aware of this. At this point, we don't have a good way
around this. Its one of those things where we've been using UDP forever
and I'm not in any position to change it :-(

On the other side of the issue, we have been using UDP forever, and we've
never experienced any major packet loss. Also, this doesn't appear to be
related directly to too much network traffic, as it only happens on the
first of the three datagrams. I was wondering if I was missing something
that was causing it to not start correctly. Basically I don't have the
option of implementing any reliability, so I wanted to do all the tweaks
possible to make it as reliable as possible.

Thanks,
Tom
 
1) Use NetMon to see if you getting the UDP reply back or is being dropped
at the server or the client.
2) When you know that, you can add debug output and try/catch block output
to see what is happening.

Without any of that, it is a bit like shooting in the dark.
 
Back
Top