Quote from help:
I tried to do the following, cause of my interpretation of description:The 'Result' returns the number of bytes effectively read. If 'Result' is equal to DataBufferLength, then more data is available to be read. If an error occured on the connection (link broken, connection close by the server etc.), 'Result' will be -1.
Code: Select all
; only used if there is an network event !!!
ReceivedBytes = ReceiveNetworkData( ConnId, *buffer, BufferLength )
Select Received Bytes
Case -1
; Connection error ==> error handling
;
Case 0
; I assume that ReceiveNetworkData will return 0
; if last ReceiveNetworkData() wrote BufferLength bytes
; in to buffer!
Case BufferLength
; According to description this means, that there is still
; data available to be read.
Default
; No more data available at this time
; ==> wait for next network event!
EndSelect
On the server:
- Client sent 16 Bytes
- I used ReceiveNetworkData( Connection, *buffer, 16 ) and got 16 Bytes!
- according to the description I called ReceiveNetworkData( ClientID, *buffer, 16 ) again and the function returned -1
- -1 does mean that there is an error! ==> but there was no error, because the server can send data back to the client!
- Server sent 16 Bytes
- I used ReceiveNetworkData( Connection, *buffer, 16 ) and got 16 Bytes!
- according to the description I called ReceiveNetworkData( ClientID, *buffer, 16 ) again and now the function blocks!
Is this a bug in the network lib? ... or is this a bug in the description? ... or do I misunderstand something? ... or ???
Thank you for all your help!
cu, helpy