ICI Modules: net
Modules by name : by typeOverview
The net module provides an ICI interface to BSD sockets, i.e, Unix network system calls. Due to laws of nature this module is also available on Windows but does not attempt to hide Windows sockets differences from other sockets implementations. Several functions are missing from the Windows version.
Socket Objects
The module provides a new type, socket, that represents, a socket connection. Sockets objects are a simple wrapper around the underlying system's way of defining a socket - a file descriptor on Unix or a SOCKET handle for Windows. Sockets are garbage collected like all other ICI objects and if a socket is collected and still open the socket is closed with any errors ignored. It should be remembered that sockets represent external OS resources. It is not good practice to rely upon garbage collection to close sockets, explicit closure is required for reliable, determistic programs.
Network Addresses
The ICI net module uses strings to define network addresses with conventions adopted as to their interpretation. These strings are converted to and from internal forms as required. The format of network addresses is described here.
Functions
net.accept - accept a new connection
net.bind - bind an address to a socket
net.close - close a socket
net.connect - connect a socket to a peer
net.gethostbyaddr - look up an address
net.gethostbyname - look up a hostname
net.getpeername - return a peer's address
net.getportno - return a socket's local port number
net.getsockname - return a socket's local name
net.getsockopt - return socket options
net.hostname - return the local hostname
net.listen - enable connection listening on a socket
net.recv - receive data from a socket
net.recvfrom - receive a message from a socket
net.select - test sockets for readiness
net.send - send data on a socket
net.sendto - send a message on a socket
net.setsockopt - set a socket option
net.shutdown - shutdown connections
net.sktno - return socket file descriptor
net.sktopen - open a socket as a file
net.socket - create a new socket
net.socketpair - create a socketpair (pipe)
net.class_of - return the class of an IPv4 network address
net.network_of - return the network of an IPv4 network address
net.bits_for_network_class - return the number of bits in this class