I have a problem sending TCP packets using C from one PC to another. Here are the steps:
I connect to the other PC as client
I use send() to send as many 1024 bytes packets as I can. Actually I try to send 100 packets of those.
I "guess" the NIC tries to fill a TCP packet with my bytes up to 1460, so that, it breaks one of my packets and send it in another TCP packet.
Then, the server only sees some of my packets, let's say 80 of my packets. I know it's related to how fast I'm sending the packets. Because if I use a small sleep between each packet, the NIC doesn't break any of my packets to fill its 1460 bytes. I can also say this because when I send packets of 512 bytes, the NIC sends two of my packets in one TCP packet of 1460 (including garbage).
BTW, I'm using ethereal to trace this and see all I'm telling you. So, my question is, is there any way in C, or any way to send my packet so that the NIC doesn't send more than one of my packets in a TCP packet?
----> Update (5 minutes later):
To make this question more clear: I'm sending 3 packets each millisecond. I have to some tests, so I have to send as fast as possible, so probably a delay won't be a solution. Also, I have to use C for evaluation purposes. If I try to send a larger packet (> 1024 bytes) then the other side of the application, the server, starts to read garbage from the socket and it usually crashes. I'm stuck here!