Node:Communication Styles, Next:Socket Addresses, Previous:Socket Concepts, Up:Sockets
The GNU library includes support for several different kinds of sockets,
each with different characteristics. This section describes the
supported socket types. The symbolic constants listed here are
defined in sys/socket.h
.
int SOCK_STREAM | Macro |
The SOCK_STREAM style is like a pipe (see Pipes and FIFOs).
It operates over a connection with a particular remote socket and
transmits data reliably as a stream of bytes.
Use of this style is covered in detail in Connections. |
int SOCK_DGRAM | Macro |
The SOCK_DGRAM style is used for sending
individually-addressed packets unreliably.
It is the diametrical opposite of SOCK_STREAM .
Each time you write data to a socket of this kind, that data becomes
one packet. Since The only guarantee that the system makes about your requests to transmit data is that it will try its best to deliver each packet you send. It may succeed with the sixth packet after failing with the fourth and fifth packets; the seventh packet may arrive before the sixth, and may arrive a second time after the sixth. The typical use for See Datagrams, for detailed information about how to use datagram sockets. |
int SOCK_RAW | Macro |
This style provides access to low-level network protocols and interfaces. Ordinary user programs usually have no need to use this style. |