Squirrel/Server/Functions/Sockets/Start
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|Socket.Start}} | |
This function starts listening incoming connections on the given port as a server socket. | This function starts listening incoming connections on the given port as a server socket. | ||
Latest revision as of 10:23, 11 October 2010
This function starts listening incoming connections on the given port as a server socket.
[edit] Syntax
bool Socket.Start( int port, int maxConnections )
[edit] Arguments
- port - This is the port the socket will listen to
- maxConnections - The maximum number of simultaneous connections to the socket
[edit] Example
function onScriptLoad( ) { p_Socket <- NewSocket( "Function" ); p_Socket.Start( 5192, 1 ); }
On script load this will tell a socket to listen for data on port 5192, with a max connection limit of 1.
[edit] Notes
The call onScriptLoad was used in in this example. The function NewSocket was also used. More info about these in the corresponding pages.