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.bindBind a socket to an address and port number.
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.recvfromReceive (read) bytes from a socket, also returning the remote address where they came from.
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.bind

FUNCTION Socket.bind(self: Socket,
address: String,
port: Number)

Bind a socket to an address and port number.

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.recvfrom

FUNCTION Socket.recvfrom(self: Socket,
count: Number,
OUT remote_address: String,
OUT remote_port: Number): Bytes

Receive (read) bytes from a socket, also returning the remote address where they came from.

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.bind(self: Socket,
address: String,
port: Number)
Bind a socket to an address and port number.
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.recvfrom(self: Socket,
count: Number,
OUT remote_address: String,
OUT remote_port: Number): Bytes
Receive (read) bytes from a socket, also returning the remote address where they came from.
FUNCTION Socket.send(self: Socket,
data: Bytes)
Send (write) bytes to a socket.
Close