Squirrel/Server/Functions/Sockets/Start

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
 
Line 1: Line 1:
__NOTOC__
+
{{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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function starts listening incoming connections on the given port as a server socket.

[edit] Syntax

  1. 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

  1.  
  2. function onScriptLoad( )
  3. {
  4. p_Socket <- NewSocket( "Function" );
  5. p_Socket.Start( 5192, 1 );
  6. }
  7.  

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.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox