Creating a socket (Internet domain)
Sockets are created by calling the
s = socket(domain, type, protocol);
The socket call also requires the
<sys/stdio.h> include file.
To create a stream socket in the Internet domain
with TCP providing the underlying support:
The domain is specified as a manifest constant named
AF_* because it indicates the ``address family''
to use in interpreting names.
For the Internet domain, the constant is always AF_INET
(address family_Internet domain).
To select a particular protocol, see
``Selecting a protocol (Internet domain)''.
If the protocol is unspecified (a value of 0), the system
selects an appropriate protocol from those available to support
the requested socket type.
The system returns a small integer
descriptor, similart to a file descriptor, to use in later system
calls which operate on sockets.
s = socket(AF_INET, SOCK_STREAM,0);
Selecting a protocol (Internet domain)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003