SOCKET OPEN()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to open a socket

Syntax

SOCKET_OPEN(<expC>, <expN1> [, <expN2>])

See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, JSON_DECODE_FILE(), JSON_ENCODE(), LIST CLASSES, LOADOBJECT(), NEWOBJECT(), OBJECT(), PRINT_JSON(), PRINT_HTML(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SELECT, SOCKET_CLOSE(), SOCKET_LASTERROR(), SOCKET_PEEK(), SOCKET_READ(), SOCKET_SERVER(), SOCKET_WRITE(), WITH, XML_DECODE_FILE()

Description

The SOCKET_OPEN() function is used to open a socket. The <expC> is the IP address or nodename of the server. The <expN1> is the TCPIP port number. The optional <expN2> is the timeout in seconds. The socket number returned from SOCKET_OPEN() should be stored for use in the other socket functions.

Example

// connect to a remote server e.g. node.js listening on port 9000
skt = socket_open("mydomain.com", 9000)
if skt < 0
    // error
endif