Accepting and Initiating Socket Connections
Sockets can be connected or unconnected. Unconnected sockets are produced
by the socket() call. An unconnected socket can become a connected socket
by:
- Client application: Actively connecting to another
socket, using the connect() call
- Server application: Binding a name to the socket,
and then listening for and accepting a connection from another socket, using
the listen() and accept()
calls.
Stream sockets require a connection before you can transfer data. Other
types of sockets, such as datagram sockets, need not establish connections
before use.
[Back: Creating and Binding Sockets]
[Next: Sending and Receiving Data]