Squirrel/Server/Functions/Sockets/Connect
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|Socket.Connect}} | |
This function connects the socket to the given server as a client. | This function connects the socket to the given server as a client. | ||
Latest revision as of 10:22, 11 October 2010
This function connects the socket to the given server as a client.
[edit] Syntax
bool Socket.Connect( string IP, int port )
[edit] Arguments
- IP - This is the IP address of the remote host
- port - This is the port of the remote host
[edit] Example
function onScriptLoad( ) { p_Socket <- NewSocket( "Function" ); p_Socket.Connect( 127.0.0.1, 6667 ); }
On script load this will connect a socket bot to local host via the 6667 port, the socket will run off the "Function" function.
[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.