Next: posix sendmail, Previous: posix daemonisations, Up: posix [Index]
The library (vicare posix tcp-server-sockets)
implements
facilities to create TCP sockets to be used by networking servers; it
is build on top of (vicare posix)
.
The following bindings are exported by the library (vicare posix
tcp-server-sockets)
.
Given a string interface representing a network interface to listen to and a network port number: open a master server socket, IP version 4, TCP protocol, bind it to the interface and port, enable it to listen for connections. Return the master socket descriptor.
interface must be a string representing the server interface to
bind to; for example localhost
. interface is used as first
argument in calls to getaddrinfo
, getaddrinfo.
port must be an exact integer representing the server port to listen to; for example 8081.
max-pending-connections must be a non-negative fixnum representing the maximum number of pending connections.
The returned socket is configured to linger for 1 second
(SO_LINGER
) and the address is configured to be reused
(SO_REUSEADDR
).
Whenever the returned socket becomes readable: it means that at least one incoming connection is pending.
Close the master socket descriptor returned by a previous call to
make-master-sock
.
Given the socket descriptor master-sock representing a master socket descriptor, already bound to an address, with a pending connection: accept the connection and configure the resulting server socket descriptor to non–blocking mode.
Return 3 values:
struct sockaddr
.
Close the Scheme port wrapping a server socket descriptor returned by a
previous call to make-server-sock-and-port
.
Next: posix sendmail, Previous: posix daemonisations, Up: posix [Index]