Hi,
I am trying to make my pda<>pc file transfer 100% robust so have been playing around with sending a confirmation message back to the pc after transfer is complete. The basic procedure for sending data to the pda from 'server' is as follows (all initially based on file transfer example code):
Server received request for data then sends a file as follows:
1. Send one byte to start
2. Send file size
3. Send file name
4. Send file contents
5. Read back confirmation of file size received from pda
The client sends a 'request' byte to start then waits for data from the server as follows:
1. Read byte to start
2. Read file size
3. Read file name
4. Read file contents
5. Write back file size of received file
This is fine in principle but in practice, what happens very often is that the server has finished transmitting the file contents and sits there waiting for the confirmation value. I have implemented a 'timeout' whilst waiting but this is regularly more than 10 seconds before the pda responds. This means that although the file has transferred correctly, the server thinks it hasn't because no confirmation was received in the time given limit. I could just increase this but surely 10 seconds is more than enough? Why is there such a delay?
I started playing around with the buffer size but my head is not calm enough to work out what the best size would be. The largest file size I have at the moment for testing is 78kB and in reality they would not be a lot larger than this.
Does anyone have any ideas on how to make this reliable or if there's a better way of ensuring data that is sent is received and confirmed the other end? I need to make sure that loss of signal / transmission errors are picked up somehow so there's absolutely no loss of data possible.
Thanks in advance
I am trying to make my pda<>pc file transfer 100% robust so have been playing around with sending a confirmation message back to the pc after transfer is complete. The basic procedure for sending data to the pda from 'server' is as follows (all initially based on file transfer example code):
Server received request for data then sends a file as follows:
1. Send one byte to start
2. Send file size
3. Send file name
4. Send file contents
5. Read back confirmation of file size received from pda
The client sends a 'request' byte to start then waits for data from the server as follows:
1. Read byte to start
2. Read file size
3. Read file name
4. Read file contents
5. Write back file size of received file
This is fine in principle but in practice, what happens very often is that the server has finished transmitting the file contents and sits there waiting for the confirmation value. I have implemented a 'timeout' whilst waiting but this is regularly more than 10 seconds before the pda responds. This means that although the file has transferred correctly, the server thinks it hasn't because no confirmation was received in the time given limit. I could just increase this but surely 10 seconds is more than enough? Why is there such a delay?
I started playing around with the buffer size but my head is not calm enough to work out what the best size would be. The largest file size I have at the moment for testing is 78kB and in reality they would not be a lot larger than this.
Does anyone have any ideas on how to make this reliable or if there's a better way of ensuring data that is sent is received and confirmed the other end? I need to make sure that loss of signal / transmission errors are picked up somehow so there's absolutely no loss of data possible.
Thanks in advance