SOCKET WRITE()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to write data to an open socket connection

Syntax

SOCKET_WRITE(<expN>, <expC>)

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_OPEN(), SOCKET_PEEK(), SOCKET_READ(), SOCKET_SERVER(), WITH, XML_DECODE_FILE()

Description

The SOCKET_WRITE() function is used to write data to an open socket connection. The <expN> is the socket number returned from SOCKET_OPEN() or SOCKET_SERVER(). The <expC> is the string containing the data to write to the socket.

Example

// assume we are connected to node.js (as an example) then 
// send the data in JSON format
data = json_encode(myobj)
 
// write the JSON encoded object to the socket
m_count = socket_write(skt, data)
if m_count != len(data)
    // error sending data
endif