Raw sockets are intended for advanced users who wish to take advantage of some protocol feature that is not directly accessible through a normal interface, or who wish to build new protocols atop existing low-level protocols. Raw sockets are normally datagram-oriented, though their exact characteristics are dependent on the interface provided by the protocol. Provides sequenced, reliable, and unduplicated flow of information. This type of socket supports the bidirectional flow of data, which is sequenced and unduplicated, but is not reliable. Since this is a connection-oriented service, the socket must be connected prior to data transfer.
Application programs can receive datagrams through sockets using the recv subroutines.
The application program must specify the address family in which the communication takes place. A stream socket must be connected before any data can be sent or received on it. Use the read and write subroutines or the send and recv subroutines to transfer data. Use the close subroutine to finish the session. If a piece of data for which the peer protocol has buffer space cannot be successfully transmitted within a reasonable period of time, the connection is broken.