_TCPServer_OnReceive
Previous Top Next

TCPServer_OnReceive ( string $sFunction )

Sets a callback function for the OnReceive event.

This event is fired every time a client sends some data.

$sFunction function will receive four parameters:
·     The first parameter is the socket ID for the new client
·     The second parameter is the IP address of the new client
·     The third parameter is the whole data sent by the client
·     The forth parameter is the parameter set by you using the _TCPServer_SetParam function

 You must retreive all the 4 parameters on your function, even if you're not going to use one or more of them. Like this:

Func MyCallbackFunc($iSocket, $sIP, $sData, $sParam)

EndFunc

It's worth to remember that setting up events is not mandatory.