DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with sockets

Address and protocol families

The socket function creates a socket descriptor that represents a communications end-point. This descriptor can be used by the application to access the underlying network. The socket function call has three arguments, domain, address type and protocol. For example, to create an IPv4 (UDP) socket, specify the following:

   s = socket(PF_INET, SOCK_DGRAM, 0);
To create an IPv6 socket you need to use another domain name. The domain name for IPv6 is PF_INET6 and the corresponding address family name that is needed by other sockets functions is AF_INET6. For example, to create an IPv6 (TCP) socket specify the following:
   s = socket(PF_INET6, SOCK_STREAM, 0)


NOTE: When using an IPv6 socket, you must always pass addresses using the sockaddr_in6 structure (described in ``The IPv6 sockaddr structure'').


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004