Next: , Up: System_network


3.2.5.1 System.network.socket

This package contains basic support for network sockets.

Supported constructors:

System.network.socket(domain, type, protocol)
Creates a new socket in domain of type type, with protocol protocol.

Supported constants:

SOCK_DGRAM
Datagram socket (UDP)
SOCK_STREAM
Stream socket (TCP)
SOCK_SEQPACKET
Sequenced-packet socket
AF_UNIX
Unix domain socket
AF_UNSPEC
Unspecified socket address type
AF_INET
Internet socket

Supported methods:

accept()
Accepts a new connection. Returns a list of [socket, host, port].
bind(host, port)
Binds socket to the given host and port.
close()
Closes socket.
connect(host, port)
Connects to the given host and port.
listen(backlog)
Listen for connections on the given socket, with backlog maximum pending connections.
read(bytes)
Reads bytes bytes from the socket.
write(bytes)
Writes bytes to the socket.