244 | | SendfileII and getfileII use the following protocol for transferring files. GetfileII opens its socket to listen on the TCP "ServerPort". When sendfileII has a file to send, it will make a connection to the getfileII socket. Each "block" of data that sendfileII sends is preceded by a six-digit integer indicating the block size. SendfileII first sends the name of the file it is about to transmit (preceded by the name length as described above). It then sends blocks of 4096 characters of file contents (or the remaining file contents if less than 4096) to getfileII. Again, each block is preceded by its size. |
245 | | |
246 | | After sendfileII has completed sending the file, it sends one more six-digit integer of zeros, to indicate that the file transmission is complete. When getfileII accepts the connection from sendfileII and receives the file name, it will create a new file by this name in TempDir. GetfileII will then write the data it receives from sendfileII into this file. When getfileII receives the file block size of zero, it will close the file in TempDir and move it to the directory for the client from which it received the file. GetfileII will also send the three characters "ACK" back to sendfileII when getfileII has successfully written the file to disk in TempDir. |
247 | | |
248 | | If getfileII has errors receiving the file data, sending the "ACK", or times out receiving or sending, it will close its active socket, delete the file from TempDir, and go back to listening for client connections. If sendfileII has errors connecting to getfileII, has errors sending the file, or cannot send a packet within "TimeOut" seconds, it will close its socket, wait for "RetryInterval" seconds, and make another attempt to send the file. It will keep trying to send the file until it has received and acknowledgment from getfileII. |
| 245 | SendfileII and getfileII use the following protocol for transferring files. GetfileII opens its socket to listen on the TCP "!ServerPort". When sendfileII has a file to send, it will make a connection to the getfileII socket. Each "block" of data that sendfileII sends is preceded by a six-digit integer indicating the block size. SendfileII first sends the name of the file it is about to transmit (preceded by the name length as described above). It then sends blocks of 4096 characters of file contents (or the remaining file contents if less than 4096) to getfileII. Again, each block is preceded by its size. |
| 246 | |
| 247 | After sendfileII has completed sending the file, it sends one more six-digit integer of zeros, to indicate that the file transmission is complete. When getfileII accepts the connection from sendfileII and receives the file name, it will create a new file by this name in !TempDir. GetfileII will then write the data it receives from sendfileII into this file. When getfileII receives the file block size of zero, it will close the file in !TempDir and move it to the directory for the client from which it received the file. GetfileII will also send the three characters "ACK" back to sendfileII when getfileII has successfully written the file to disk in !TempDir. |
| 248 | |
| 249 | If getfileII has errors receiving the file data, sending the "ACK", or times out receiving or sending, it will close its active socket, delete the file from !TempDir, and go back to listening for client connections. If sendfileII has errors connecting to getfileII, has errors sending the file, or cannot send a packet within "!TimeOut" seconds, it will close its socket, wait for "!RetryInterval" seconds, and make another attempt to send the file. It will keep trying to send the file until it has received and acknowledgment from getfileII. |