- Server socket
A server socket is a
computer communication s end point for new incoming connections. The server socket accepts incoming connections, handles lower-level network traffic to finalize the connection and then forks a new connection for reading or writing. The server socket continues to be available to accept other incoming connections.Pseudocode example
#Create a server socket ServerSocket = CreateNewSocket( AF_INET, SOCK_STREAM ); BindSocketToIP( ServerSocket, LOCALIP ); ListenForConnections( ServerSocket ); #Accept incoming connections While( TRUE ) { NewSocket = AcceptConnection( ServerSocket ); While( Data = ReceiveData( NewSocket ) ) { ... } }
AF_INET refers to the socket using a standard
network protocol , in this caseIPv4 . SOCK_STREAM refers to the socket using a standardtransport protocol , in this case TCP. See the article onBerkeley sockets for further information.----
Wikimedia Foundation. 2010.