Socket types define the communication properties that are visible to a user. The Internet family sockets provide access to the TCP/IP transport protocols. The Internet family is identified by the value AF_INET6, for sockets that can communicate over both IPv6 and IPv4. The value AF_INET is also supported for source compatibility with old applications and for raw access to IPv4.
The SunOS environment supports four types of sockets:
Stream sockets enable processes to communicate
using TCP. A stream socket provides a bidirectional, reliable, sequenced,
and unduplicated flow of data with no record boundaries. After the connection
has been established, data can be read from and written to these sockets as
a byte stream. The socket type is SOCK_STREAM
.
Datagram sockets
enable processes to use UDP to communicate. A datagram socket supports a bidirectional
flow of messages. A process on a datagram socket might receive messages in
a different order from the sending sequence. A process on a datagram socket
might receive duplicate messages. Messages that are sent over a datagram socket
might be dropped. Record boundaries in the data are preserved. The socket
type is SOCK_DGRAM
.
Raw sockets provide access to ICMP. Raw
sockets also provide access to other protocols based on IP that are not directly
supported by the networking stack. These sockets are normally datagram oriented,
although their exact characteristics are dependent on the interface provided
by the protocol. Raw sockets are not for most applications. Raw sockets are
provided to support the development of new communication protocols, or for
access to more esoteric facilities of an existing protocol. Only superuser
processes can use raw sockets. The socket type is SOCK_RAW
.
SEQ sockets support 1-to-N Stream Control Transmission Protocol (SCTP) connections. More details on SCTP are in Stream Control Transmission Protocol.
See Selecting Specific Protocols for further information.