net

Functions for working with network sockets.

Summary
netFunctions for working with network sockets.
Exceptions
SocketExceptionIndicates some kind of socket error.
Types
SocketOpaque type representing a network socket.
Functions
tcpSocketCreate a new TCP/IP (stream) socket.
selectSelect sockets with pending activity subject to an optional timeout.
Socket.acceptAccept an incoming connection request on a socket and returns a new socket.
Socket.closeClose a socket.
Socket.connectConnect a socket to a given host and port.
Socket.listenListen for incoming connections on a specific port.
Socket.recvReceive (read) bytes from a socket.
Socket.sendSend (write) bytes to a socket.

Exceptions

SocketException

Indicates some kind of socket error.

Types

Socket

Opaque type representing a network socket.

Functions

tcpSocket

DECLARE NATIVE FUNCTION tcpSocket(): Socket

Create a new TCP/IP (stream) socket.

select

FUNCTION select(INOUT read,
 write,
error: Array<Socket>,
timeout_seconds: Number): Boolean

Select sockets with pending activity subject to an optional timeout.

Socket.accept

FUNCTION Socket.accept(self: Socket): Socket

Accept an incoming connection request on a socket and returns a new socket.

Socket.close

FUNCTION Socket.close(self: Socket)

Close a socket.

Socket.connect

FUNCTION Socket.connect(self: Socket,
host: String,
port: Number)

Connect a socket to a given host and port.

Socket.listen

FUNCTION Socket.listen(self: Socket,
port: Number)

Listen for incoming connections on a specific port.

Socket.recv

FUNCTION Socket.recv(self: Socket,
count: Number): Bytes

Receive (read) bytes from a socket.

Socket.send

FUNCTION Socket.send(self: Socket,
data: Bytes)

Send (write) bytes to a socket.

DECLARE NATIVE FUNCTION tcpSocket(): Socket
Create a new TCP/IP (stream) socket.
FUNCTION select(INOUT read,
 write,
error: Array<Socket>,
timeout_seconds: Number): Boolean
Select sockets with pending activity subject to an optional timeout.
FUNCTION Socket.accept(self: Socket): Socket
Accept an incoming connection request on a socket and returns a new socket.
FUNCTION Socket.close(self: Socket)
Close a socket.
FUNCTION Socket.connect(self: Socket,
host: String,
port: Number)
Connect a socket to a given host and port.
FUNCTION Socket.listen(self: Socket,
port: Number)
Listen for incoming connections on a specific port.
FUNCTION Socket.recv(self: Socket,
count: Number): Bytes
Receive (read) bytes from a socket.
FUNCTION Socket.send(self: Socket,
data: Bytes)
Send (write) bytes to a socket.
Close