Hi,
I have integrated a winsock server in my app and works fine as long as complete data packages are received. The server is based on a famous example (I think):
The problem is how to determine that received data is complete. The wiki example solves it by adding a end-of-transmission sign in alla sent data. In the same way, received data isn't computed until the EOT sign is reached.
++++++++++++snip
PROCEDURE DataArrival
LPARAMETERS tnByteCount
LOCAL lcBuffer
lcBuffer = SPACE(tnByteCount)
* This gets the data from the socket. It can happen, that the data isn't
* received in a single rush. Thus we need a EOT (end of transmission)
* sign to be sure, the data is complete. Until we get this, the data
* is stuffed into cReceiveBuffer.
This.GetData( @lcBuffer, , tnByteCount )
IF AT( EOT, lcBuffer ) = 0 && Not yet finished
This.cReceiveBuffer = This.cReceiveBuffer + lcBuffer
ELSE
This.cReceiveBuffer = This.cReceiveBuffer + LEFT( lcBuffer, AT( EOT, lcBuffer ) -1 )
...
++++++++++++snip
The data I want to receive comes from a POST action in a web browser form. How can I determine (in the DataArrival event) that all data has been received? Any hints are welcome.
Thanks'
Micael
I have integrated a winsock server in my app and works fine as long as complete data packages are received. The server is based on a famous example (I think):
The problem is how to determine that received data is complete. The wiki example solves it by adding a end-of-transmission sign in alla sent data. In the same way, received data isn't computed until the EOT sign is reached.
++++++++++++snip
PROCEDURE DataArrival
LPARAMETERS tnByteCount
LOCAL lcBuffer
lcBuffer = SPACE(tnByteCount)
* This gets the data from the socket. It can happen, that the data isn't
* received in a single rush. Thus we need a EOT (end of transmission)
* sign to be sure, the data is complete. Until we get this, the data
* is stuffed into cReceiveBuffer.
This.GetData( @lcBuffer, , tnByteCount )
IF AT( EOT, lcBuffer ) = 0 && Not yet finished
This.cReceiveBuffer = This.cReceiveBuffer + lcBuffer
ELSE
This.cReceiveBuffer = This.cReceiveBuffer + LEFT( lcBuffer, AT( EOT, lcBuffer ) -1 )
...
++++++++++++snip
The data I want to receive comes from a POST action in a web browser form. How can I determine (in the DataArrival event) that all data has been received? Any hints are welcome.
Thanks'
Micael