Squirrel/Server/Functions/Sockets/Connect

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

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

This function connects the socket to the given server as a client.

[edit] Syntax

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

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

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.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox