DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications over TCP/IP using Internet sockets

Creating a socket (Internet domain)

Sockets are created by calling the socket(SSC) routine:

s = socket(domain, type, protocol);


domain
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).

type
Types are:

SOCK_STREAM
SOCK_DGRAM
SOCK_RAW


protocol
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.
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:
   #include <sys/stdio.h>
   s = socket(AF_INET, SOCK_STREAM,0);

Next topic: Selecting a protocol (Internet domain)
Previous topic: Raw sockets

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003