Sockets
Server
- A server accepts incomming connections from clients by
- Creating a socket
- Binding the socket to a specified port
- Setting the socket to listen (act as a server), and then
- Waiting to accept incomming connections
- For example
socket( S, PF_INET, SOCK_STREAM, (getprotobyname('tcp'))[2] );
bind( S, sockaddr_in( $port, INADDR_ANY ) );
listen( S, SOMAXCONN );
accept( C, S );