Specifications

5.3.3 Sending files from the PC to the Ethernut
To test whether the Ethernut can transfer files successfully, the server program on the
PC first has to open files in Windows, read from the file into a buffer and then transmit
the buffer via TCP.
5.3.3.1 Sending files through a TCP connection
The ReadFile function in Windows programming reads the requested length or less if it
reaches the end of the file. The next time the ReadFile function is called it reads from
the end of the last read performed on that file handler. Therefore it is not required to
store where in the file the reading is up to.
After working out how to open files, the next part tested was the possibility of packet
transmission through a TCP connection and the possibility of post transmission
reconstruction back into the original file form. This was done by creating two programs
in Windows; one that reads a packet of data out of a file and then sends that packet via
TCP, the other program was to receive the TCP packets and then write them into a file.
This TCP file transfer is show in figure 10
Open file
Read file data
Send packet
Process 1
Create file
Write data to
file
Receive
packet
Process 2
Figure 10 TCP file transfer
This test was successful, it could send any type of file and it would come out from
process 2 the same it went into process 1. Next it was time to see if the data remained
intact if it went through the Ethernut.
27