ReceiveNetworkData()

Syntax

Result = ReceiveNetworkData(Connection, *DataBuffer, DataBufferLength)
Description
Receives raw data from the specified client. This function can be used by both client and server applications and should be called only after having received a #PB_NetworkEvent_Data event.

Parameters

Connection The connection to receive data from. On the server side 'Connection' is the client which has send the data (can be easily obtained with EventClient()). On client side, 'Connection' is returned by OpenNetworkConnection().
*DataBuffer The memory address to receive the data to.
DataBufferLength The length of the buffer to receive data to.

Return value

Returns the number of bytes received. If 'Result' is equal to DataBufferLength then more data is available to be read. If an error occurred on the connection (link broken, connection close by the server etc...) 'Result' will be -1.

Remarks

On UDP connections, the maximum 'DataBufferLength' is 2048. On TCP connections, the maximum 'DataBufferLength' is 65536.

See Also

NetworkClientEvent(), NetworkServerEvent(), SendNetworkData()

Supported OS

All

<- OpenNetworkConnection() - Network Index - SendNetworkData() ->