Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are many things wrong in the code.</p> <ol> <li>The file size / transfer size is hardcoded to 4294967295 bytes. So, if the file supplied isn't that many bytes, you'll have problems.</li> <li>In the sender, you aren't checking if the file read is successful or not. So if the file is smaller than 4294967295 bytes, you won't know it and send junk data (or nothing at all) over the network.</li> <li>When you use UDP and DDCP, the packets order isn't guarantee, so the data received may be out of order (ie. junk).</li> <li>When you use UDP, there's no retransmission of lost packet, so some data may never be received.</li> <li>In the receiver, you aren't check how many bytes you received, you always write MAX_LINE bytes to the file. So even if you receive 0 bytes, you'll still be writing to the file, which is wrong.</li> <li>When you use UDP, since you're sending in a thigh loop, even if the write() call return the same amount of bytes sent that what you requested, a lot of data will probably be dropped by the network stack or the network interface, since there's no congestion control in place. So, you will need to put some congestion control in place yourself.</li> </ol> <p>And this is just from a quick scan of the code, there is probably more problems in there...</p> <p>My suggestion is : Try the transfer with TCP, do a md5sum of the file you read/send, and a md5sum of the file you receive/save, and compare the 2 md5sum. Once you have this case working, you can move to testing (still using the md5sum comparison) with UDP and DCCP...</p> <p>For the tcpdump command, you should change <code>-s 1500</code> for <code>-s 0</code>, which means <code>unlimited</code>. With that tcpdump command, you can trust it that data not seen by it hasn't been sent/received. Another good thing to do is to compare the tcpdump output of the sender with the receiver. This way you'll know if some packet lost occurred between the two network stacks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload