Hi, I need help with my file transfer function. In tests, the sender sends
the file but the receiver never seems to get the complete file, only 99.9%
of the file. [only once did it the receive the full file].
Can someone tell me what is wrong with my function. On the receivers end, I
have it go in a while loop containing the recv() until recv() == 0 and for
the sender, I have it in a while loop until it sends all of the data. The
test file is 4.9MB. The laptop NIC is USB. When I send it to the desktop
from the laptop, it almost always sends full packets but when I send the
file from the desktop to the laptop, the laptop receives a lot of packets
which are smaller than the programs packet buffer size. I use 8192 bytes as
the buffer size. Also, the laptop is win98 and the desktop is win2k.
Here are the results:
amount read from file: total amount of bytes read from the file
amount sent: total amount of bytes sent using send()
packet errors detected: number of send()s that sent less than the maximum
buffer size
actual time vs ETA: actual number of packets sent | estimation of how
many packets will be sent
Here is the stripped code (I took out the error handling functions and there
are data members and functions defined outside of sendfile(),
receivefile(). )
=============================================
Transfer Test 1:
results from sender (laptop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from receiver (desktop)
amount read from packets: 4918833
amount written to file: 4918833
packet errors detected: 9
actual time vs ETA: 604 | 601
==============================================
Transfer Test 2:
results from sender (desktop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from receiver (laptop)
amount read from packets: 4920282
amount written to file: 4920282
packet errors detected: 908
actual time vs ETA: 1048 | 601
==============================================
Transfer Test 3:
results from sender (laptop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from receiver (desktop)
amount read from packets: 4918833
amount written to file: 4918833
packet errors detected: 4
actual time vs ETA: 602 | 601
==============================================
Transfer Test 4:
results from sender (desktop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from sender (laptop)
amount read from packets: 4918833
amount written to file: 4918833
packet errors detected: 883
actual time vs ETA: 1034 | 601
the file but the receiver never seems to get the complete file, only 99.9%
of the file. [only once did it the receive the full file].
Can someone tell me what is wrong with my function. On the receivers end, I
have it go in a while loop containing the recv() until recv() == 0 and for
the sender, I have it in a while loop until it sends all of the data. The
test file is 4.9MB. The laptop NIC is USB. When I send it to the desktop
from the laptop, it almost always sends full packets but when I send the
file from the desktop to the laptop, the laptop receives a lot of packets
which are smaller than the programs packet buffer size. I use 8192 bytes as
the buffer size. Also, the laptop is win98 and the desktop is win2k.
Here are the results:
amount read from file: total amount of bytes read from the file
amount sent: total amount of bytes sent using send()
packet errors detected: number of send()s that sent less than the maximum
buffer size
actual time vs ETA: actual number of packets sent | estimation of how
many packets will be sent
Here is the stripped code (I took out the error handling functions and there
are data members and functions defined outside of sendfile(),
receivefile(). )
=============================================
Transfer Test 1:
results from sender (laptop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from receiver (desktop)
amount read from packets: 4918833
amount written to file: 4918833
packet errors detected: 9
actual time vs ETA: 604 | 601
==============================================
Transfer Test 2:
results from sender (desktop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from receiver (laptop)
amount read from packets: 4920282
amount written to file: 4920282
packet errors detected: 908
actual time vs ETA: 1048 | 601
==============================================
Transfer Test 3:
results from sender (laptop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from receiver (desktop)
amount read from packets: 4918833
amount written to file: 4918833
packet errors detected: 4
actual time vs ETA: 602 | 601
==============================================
Transfer Test 4:
results from sender (desktop)
amount read from file: 4920282
amount sent: 4920282
packet errors detected: 1
actual time vs ETA: 600 | 601
results from sender (laptop)
amount read from packets: 4918833
amount written to file: 4918833
packet errors detected: 883
actual time vs ETA: 1034 | 601