Squirrel/Server/Functions/Sockets/SetLostConnFunc
(New page: __NOTOC__ This function sets a socket handler function for lost connections. Note that you cannot use functions defined inside a class or a namespace. The handler function is called every ...) |
Revision as of 08:46, 14 December 2009
This function sets a socket handler function for lost connections. Note that you cannot use functions defined inside a class or a namespace. The handler function is called every time a connection has been lost (either a client or a server connection).
If the socket acts as a client socket, ie. it is connected to a server, the handler function does not take any arguments. However if the socket is a server socket (ie. different clients can connect to it) the handler function should be in the following format (clientID: The ID of the client that lost connection, clientIPAddress: The IP address of the client, clientPort: the port of the client):
function FunctionName( int clientID, string clientIPAddress, int clientPort )
Syntax
Socket.SetLostConnFunc can take 2 different lists of parameters. These are:
bool Socket.SetLostConnFunc( string szFuncname )
bool Socket.SetLostConnFunc( function pFunc )
Arguments
- szFuncname - This is the name of the handler function as a string
- pFunc - This is a pointer to the handler function (closure)
Example
-- todo
Notes
-- Example notes/used functions here
Related Functions
- NewSocket
- Socket.Connect
- Socket.Delete
- Socket.Send
- Socket.SendClient
- Socket.SetLostConnFunc
- Socket.SetNewConnFunc
- Socket.Start
- Socket.Stop
- Socket.Close