I'm having some odd problems with a little program I wrote for
sending/receiving bytes across the network.
I am using synchronous sockets, and it seems that when I send byte
after byte too fast, the packet gets lots somewhere (as odd as that
Here's the sending code:
int cSent = 0;
while (cSent == 0)
cSent = sHandler.Send(byteSend, 0,
catch (SocketException se)
The receiving code is basicly a thread that keeps on running untill
the socket is connected and reads 1 byte per byte. Since i'm using
blocking sockets that seems to work fine.
Simple enough, I use these functions to send chars over a TCP
connection.I read an array of bytes byte per byte and use the function
above to send byte per byte. From what I've tested, if I send too
fast, the receiver never gets all the data. If I would to put a small
delay, like Sleep(1) in there, then everything works fine.
I installed a network sniffer on each workstations I am testing this
code off and as I've said, when I send too fast (as in, no delay after
each byte) the network sniffer on the sender side shows the packet
with the data I'm trying to send, but the receiver's network sniffer
does not. If I put a delay in there, I can see the packet with the
data I'm sending on both sides. I've also tried using a cross-over
cable to remove any possible network interferences and the result is
still the same. As far as the sender is concerned, it sends the data,
and as far as the receiver is concerned, it never gets it.
Does anybody have any idea what's going on, because I'm flat out of