All Functions Modules Pages
socket

Functions

SOCKET socket.server (NUMBER port)
 Creates a server socket, this permits, be a net server. More...
 
SOCKET socket.accept (SOCKET zock)
 It accepts a request from a client and create a direct connection socket. More...
 
SOCKET socket.connect (STRING url, NUMBER port)
 Opens a socket using the adress and ports indicated. More...
 
NUMBER socket.send (SOCKET zock, STRING data)
 Send data through the socket. More...
 
NUMBER socket.send (SOCKET zock, STRING data, NUMBER size)
 Send data through the socket. More...
 
STRING socket.recv (SOCKET zock, NUMBER size)
 Receive data through the socket. More...
 
NIL socket.close (SOCKET zock)
 Close the socket. More...
 

Detailed Description

Internet connection using sockets.

Function Documentation

SOCKET socket.server ( NUMBER  port)

Creates a server socket, this permits, be a net server.

Parameters
portPort to use for the connection, if omitted will use port 80 by default.
Note
This socket can only be used with the function socket.accept().
Returns
Socket object type, ready to use.
SOCKET socket.accept ( SOCKET  zock)

It accepts a request from a client and create a direct connection socket.

Parameters
zockA socket of type server.
Returns
Socket object type, ready to use.
SOCKET socket.connect ( STRING  url,
NUMBER  port 
)

Opens a socket using the adress and ports indicated.

Parameters
urlServer adress.
portPort to use for connect.
Returns
Socket object type, ready to use.
NUMBER socket.send ( SOCKET  zock,
STRING  data 
)

Send data through the socket.

Parameters
zockAn opened socket.
dataData to send.
Returns
Number of sent bytes.
NUMBER socket.send ( SOCKET  zock,
STRING  data,
NUMBER  size 
)

Send data through the socket.

Parameters
zockAn opened socket.
dataData to send.
sizeSize of the data to send.
Returns
Number of sent bytes.
STRING socket.recv ( SOCKET  zock,
NUMBER  size 
)

Receive data through the socket.

Parameters
zockAn opened socket.
sizeSize of the data for receive. It will receive 1024 bytes default if is omitted.
Returns
Data received. Also, returns the number of bytes received (may not match the number of bytes requested).
NIL socket.close ( SOCKET  zock)

Close the socket.

Parameters
zockSocket to be closed.
Returns
Nothing.