Node:Creating a Socket, Next:Closing a Socket, Up:Open/Close Sockets
The primitive for creating a socket is the socket
function,
declared in sys/socket.h
.
int socket (int namespace, int style, int protocol) | Function |
This function creates a socket and specifies communication style
style, which should be one of the socket styles listed in
Communication Styles. The namespace argument specifies
the namespace; it must be PF_LOCAL (see Local Namespace) or
PF_INET (see Internet Namespace). protocol
designates the specific protocol (see Socket Concepts); zero is
usually right for protocol.
The return value from
The file descriptor returned by the |
For examples of how to call the socket
function,
see Local Socket Example, or Inet Example.