socketOpen


socketOpen socketId

socketOpen (host, port)

Creates a TCP/IP socket connected to the host and port. The host may be a host name or an IP address given as a string. Domain Name Services must be set up properly for names to be given.

Parameters:

host - String the host name or IP address of the remote computer.

port - a number for the TCP/IP port number.

Returns:

A socket identifier or false if the connection could not be named. This is passed to socketWrite and socketClose functions to identify the socket. If false is returned, the error will be saved and can be obtained by calling socketGetLastError().

Example:

sock = socketOpen("172.21.46.96", 7474)

if sock == true then

status = socketWrite(sock, "Hello World")

if status == false then

trace("Socket Write Error: " & socketGetLastError(), YELLOW)

endif

socketClose(sock)

else

trace("Socket Open Error: " & socketGetLastError(), YELLOW)

endif

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*