Next: 6.0.2 The Recvfrom() call
Up: 6 The Socket API
Previous: 6 The Socket API
6.0.1 The Socket() call
The Socket() call accepts three arguments: family, type,
and protocol. It supports the following
three combinations of family and type:
- AF_INET/SOCK_STREAM: this combination specifies that the
user wants to create a TCP socket. The following system calls are allowed on a TCP socket:
Close(), Bind(), Accept(), Connect(), Write(), Read(), and Setsockopt(). There is no Listen() call, its functionality is subsumed by the Accept()
call as described in Section 7
- AF_INET/SOCK_DGRAM: this combination specifies that the
user wants to create a UDP socket.
The following system calls are allowed on a UDP socket:
Close(), Bind(), Sendto(), Recvfrom(), and
Setsockopt().
- AF_INET/SOCK_ICMP: this combination specifies that the user
wants to create an ICMP socket. The following system calls are allowed on an
ICMP socket: Close() and Recvfrom().
- AF_ROUTE/SOCK_RAW: this combination specifies that the user
wants to create a routing socket. The following system calls are allowed on
a routing socket: Close(), Write(), and Setsockopt().
Next: 6.0.2 The Recvfrom() call
Up: 6 The Socket API
Previous: 6 The Socket API