Next: Local Sockets
Up: Sockets
Previous: System Calls
Contents
- A server's life cycle consists of
- the creation of a connection-style (tcp) socket,
- binding an address to its socket,
- placing a call to listen that enables connections to the socket,
- placing calls to accept incoming connections,
- and then closing the socket.
- Data isn't read and written directly via the server socket; instead, each time a program accepts a new connection, Linux creates a separate socket to use in transferring data over that connection.
- An address must be bound to the server's socket using bind if a client is to find it.
- When an address is bound to a connection-style socket, it must invoke listen to indicate that it is a server.
- A server accepts a connection request from a client by invoking accept.
- The call to accept creates a new socket for communicating with the client and returns the corresponding file descriptor.
- The original server socket continues to accept new client connections.
Next: Local Sockets
Up: Sockets
Previous: System Calls
Contents
Cem Ozdogan
2007-05-16