Socket – Comtrol eCos User Manual
Page 575

Chapter 38. TCP/IP Library Reference
BSD
June 4, 1993
BSD
socket
SOCKET(2)
System Calls Manual
SOCKET(2)
NAME
socket - create an endpoint for communication
SYNOPSIS
#include
<
sys/types.h>
#include
<
sys/socket.h>
int
socket(int domain, int type, int protocol);
DESCRIPTION
socket() creates an endpoint for communication and returns a descriptor.
The domain parameter specifies a communications domain within which com-
munication will take place; this selects the protocol family which should
be used.
These families are defined in the include file
<
sys/socket.h>.
The currently understood formats are
AF_UNIX
(UNIX internal protocols),
AF_INET
(ARPA Internet protocols),
AF_INET6
(ARPA IPv6 protocols),
AF_ISO
(ISO protocols),
AF_NS
(Xerox Network Systems protocols),
AF_IPX
(Internetwork Packet Exchange), and
AF_IMPLINK
(IMP host at IMP link layer).
The socket has the indicated type, which specifies the semantics of com-
munication.
Currently defined types are:
SOCK_STREAM
SOCK_DGRAM
SOCK_RAW
SOCK_SEQPACKET
SOCK_RDM
A SOCK_STREAM type provides sequenced, reliable, two-way connection based
byte streams.
An out-of-band data transmission mechanism may be sup-
ported.
A SOCK_DGRAM socket supports datagrams (connectionless, unreli-
able messages of a fixed (typically small) maximum length).
A
SOCK_SEQPACKET socket may provide a sequenced, reliable, two-way connec-
tion-based data transmission path for datagrams of fixed maximum length;
a consumer may be required to read an entire packet with each read system
call.
This facility is protocol specific, and presently implemented only
for PF_NS.
SOCK_RAW sockets provide access to internal network protocols
and interfaces.
The types SOCK_RAW, which is available only to the supe-
ruser, and SOCK_RDM, which is planned, but not yet implemented, are not
471