TCP

Name

TCP -- 

Function

<nNewSocket>        TCPACCEPT(<nSock>[, <nTimeout>])
TRUE || FALSE       TCPCLOSE(<nConnection>)
<nConnection>       TCPCONNECT(<sHostName>[, <nPort>][, <nTimeout>])
<nErrNo>            TCPLISTEN(<nPort>[, <nBackLog>])
<nLenBuf>           TCPREAD(<nConnection>, @<sBuffer>, <nLen>[, <nTimeout>])
<nLenBuf>           TCPWRITE(<nConnection>, <sBuffer>, <nLen>[, <nTimeout>])

Description

Function TCPACCEPT()

 TCPACCEPT(<nSock>[, <nTimeout>])	--> <nNewSocket>

TCPACCEPT() extracts the first connection request on the queue of pending connections, creates a new connected socket with mostly the same properties as <nSock>, and allocates a new file descriptor <nNewSocket> for the socket, which is returned.

FERROR() and FERRORSTR()kept the error description.

Function TCPCLOSE()

 TCPCLOSE(<nConnection>)		--> TRUE || FALSE

TCPCLOSE() closes opened connections and returns TRUE if operation was successfully.

Function TCPCONNECT()

 TCPCONNECT(<sHostName>[, <nPort>][, <nTimeout>])	--> <nConnection>

TCPCONNECT() makes connect to server <sHostName> and creates socket to port <nPort>. Returns connection number <nConnection> or -1 on error. FERROR() and FERRORSTR()kept the error description.

Function TCPLISTEN()

 TCPLISTEN(<nPort>[, <nBackLog>])	--> <nErrNo>

TCPLISTEN() creates socket and stands for incomming connections.

Function TCPREAD()

 TCPREAD(<nConnection>, @<sBuffer>, <nLen>[, <nTimeout>])	--> <nLenBuf>

TCPREAD() reads from connection <nConnection> some data (no more of <nLen> bytes) and writes it to buffer <sBuffer>. FERROR() and FERRORSTR()kept the error description.

Function TCPWRITE()

 TCPWRITE(<nConnection>, <sBuffer>, <nLen>[, <nTimeout>])	--> <nLenBuf>

TCPWRITE() trys write some data <sBuffer> (with length <nLen> bytes)to connection <nConnection>. FERROR() and FERRORSTR()kept the error description.