socket man page on DigitalUNIX

Printed from

socket(2)							     socket(2)

       socket - Create an end point for communication and return a descriptor

       #include <sys/socket.h>

       int socket(
	       int domain,
	       int type,
	       int protocol );

       Interfaces  documented on this reference page conform to industry stan‐
       dards as follows:

       socket(): XNS4.0, XNS5.0

       Refer to the standards(5) reference page	 for  more  information	 about
       industry standards and associated tags.

       Specifies the communications domain in which a socket is to be created.
       The domain argument specifies the address family with  which  addresses
       specified  in  later  socket  operations	 should	 be  interpreted.  The
       sys/socket.h file contains the definitions  of  the  address  families.
       Commonly	 used  families	 are: UNIX pathnames Internet addresses (IPv4)
       [Tru64 UNIX]   Internet addresses (IPv6)	 Specifies  the	 semantics  of
       communication. The sys/socket.h file defines the socket types. The fol‐
       lowing types are supported: Provides sequenced, reliable, two-way  byte
       streams	with  a transmission mechanism for out-of-band data.  Provides
       datagrams, which are connectionless messages of a fixed maximum length.
       [Tru64 UNIX]   Provides access to internal network protocols and inter‐
       faces. This type of socket is available only  to	 a  process  with  the
       superuser  privilege.   Specifies a particular protocol to be used with
       the socket. Specifying a protocol of 0 (zero) causes the socket() func‐
       tion  to	 default  to  the  typical  protocol for the requested type of
       returned socket.

       The socket() function creates a socket of the  specified	 type  in  the
       specified domain.

       The  socket()  function	returns	 a descriptor (an integer) that can be
       used in later system calls that operate on sockets.

       Socket level options control socket operations.	The  getsockopt()  and
       setsockopt() functions are used to get and set these options, which are
       defined in the sys/socket.h file.

       The sensitivity level of the new socket is inherited from the  creating
       process. The information label of the new socket is set to System Low.

       Upon successful completion, the socket() function returns a nonnegative
       integer (the socket descriptor). Otherwise, a value of -1  is  returned
       and errno is set to indicate the error.

       If  the socket() function fails, errno may be set to one of the follow‐
       ing values: The process have  not  have	appropriate  privileges.   The
       addresses  in the specified address family are not supported.  The per-
       process descriptor table is full.  No more file descriptors are	avail‐
       able for the system.  Insufficient resources were available in the sys‐
       tem to complete the call.  The system was  unable  to  allocate	kernel
       memory to increase the process descriptor table.	 The available STREAMS
       resources were insufficient for	the  operation	to  complete.	[Tru64
       UNIX]  The process is attempting to open a raw socket and does not have
       the superuser privilege.	 The protocol is not supported by  the	speci‐
       fied  address family or the protocol is not supported.  The socket type
       is not supported by the protocol.

       Functions: accept(2), bind(2), connect(2),  listen(2),  getsockname(2),
       getsockopt(2),  recv(2),	 recvfrom(2),  recvmsg(2), send(2), sendto(2),
       sendmsg(2), setsockopt(2), shutdown(2), socketpair(2)

       Standards: standards(5)

       Network Programmer's Guide


List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net