Minix Man Pages

Man Page or Keyword Search:
Man Architecture
Apropos Keyword Search (all sections) Output format
home | help
SOCKET(2)                     System Calls Manual                    SOCKET(2)

NAME
       socket - creates a socket.

SYNOPSIS
       #include <sys/socket.h>

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

DESCRIPTION
       socket()  creates  a  socket  in  the  specified  domain. A socket is a
       communications endpoint. Currently two values are supported for domain,
       PF_INET for internet sockets and PF_UNIX for local unix domain sockets.
       The type of socket can be SOCK_STREAM for TCP sockets  in  the  PF_INET
       domain or SOCK_DGRAM for UDP sockets in the PF_INET domain. For sockets
       in the PF_UNIX domain, SOCK_STREAM, SOCK_DGRAM, and SOCK_SEQPACKET  are
       supported  values  for  type.  The  value  of  protocol  is always 0 or
       IPPROTO_TCP for TCP sockets or IPPROTO_UDP for UDP sockets.

RETURN VALUES
       On success, this function returns  a  numeric  socket  descriptor.   On
       error, -1 is returned and errno is set.

ERRORS
       [EAFNOSUPPORT] The domain is not supported.

       [EPROTOTYPE]   The protocol is not supported by the domain.

       [EMFILE]       The process descriptor table is full.

       [ENFILE]       The system descriptor table is full.

       [ENOSPC]       Could not allocate a file descriptor.

SEE ALSO
       socketpair(2),  bind(2), listen(2), accept(2), connect(2), shutdown(2),
       getsockopt(2), setsockopt(2), ip(4), inet(8), unix(8)

                                                                     SOCKET(2)

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | SEE ALSO