Protocol-Independent C Sockets API

The following table briefly describes each protocol-independent socket call supported by networking services and identifies where you can find the syntax, parameters, and other appropriate information. The socket calls described in this section can be used to access services for all protocols.

Note: If you are using the internet communications domain (PF_INET protocol family), you can use all APIs in the following table and those in TCP/IP Network Utility Routines API.

Protocol-Independent Sockets API Quick Reference

┌──────────────────────────────────────────────────────────────────┐
│Socket Call                    Description                        │
├──────────────────────────────────────────────────────────────────┤
│accept()                       Accepts a connection request from a│
│                               remote host                        │
├──────────────────────────────────────────────────────────────────┤
│accept_and_recv()              Accepts a connection on a socket,  │
│                               receives the first message from    │
│                               the connected client, and returns  │
│                               the local and peer addresses       │
├──────────────────────────────────────────────────────────────────┤
│addsockettolist()              Adds a socket to the list of owned │
│                               sockets for the calling process    │
├──────────────────────────────────────────────────────────────────┤
│bind()                         Binds a local name to the socket   │
├──────────────────────────────────────────────────────────────────┤
│connect()                      Requests a connection to a remote  │
│                               host                               │
├──────────────────────────────────────────────────────────────────┤
│getpeername()                  Gets the name of the peer connected│
│                               to socket                          │
├──────────────────────────────────────────────────────────────────┤
│getsockname()                  Gets the local socket name         │
├──────────────────────────────────────────────────────────────────┤
│getsockopt()                   Gets the socket options associated │
│                               with a socket                      │
├──────────────────────────────────────────────────────────────────┤
│ioctl()                        Performs special operations on     │
│                               sockets                            │
├──────────────────────────────────────────────────────────────────┤
│listen()                       Completes the binding necessary for│
│                               a socket to accept connections and │
│                               creates a connection request queue │
│                               for incoming requests              │
├──────────────────────────────────────────────────────────────────┤
│os2_ioctl()                    Performs special operations on     │
│                               sockets; in particular, operations │
│                               related to returning status from   │
│                               kernel                             │
├──────────────────────────────────────────────────────────────────┤
│os2_select()                   Gets read, write, and exception    │
│                               status on a group of sockets (OS/2 │
│                               version)                           │
├──────────────────────────────────────────────────────────────────┤
│psock_errno()                  Writes a short error message to the│
│                               standard error device              │
├──────────────────────────────────────────────────────────────────┤
│readv()                        Receives data on a socket into a   │
│                               set of buffers                     │
├──────────────────────────────────────────────────────────────────┤
│recv()                         Receives data on a connected socket│
├──────────────────────────────────────────────────────────────────┤
│recvfrom()                     Receives data on a socket          │
├──────────────────────────────────────────────────────────────────┤
│recvmsg()                      Receives data and control          │
│                               information on a socket            │
├──────────────────────────────────────────────────────────────────┤
│removesocketfromlist()         Removes a socket from the list of  │
│                               owned sockets for the calling      │
│                               process                            │
├──────────────────────────────────────────────────────────────────┤
│select()                       Gets read, write, and exception    │
│                               status on a group of sockets (BSD  │
│                               version)                           │
├──────────────────────────────────────────────────────────────────┤
│send()                         Sends data on a connected socket   │
├──────────────────────────────────────────────────────────────────┤
│send_file()                    Sends the file data over a         │
│                               connected socket                   │
├──────────────────────────────────────────────────────────────────┤
│sendmsg()                      Sends data and control information │
│                               on a socket                        │
├──────────────────────────────────────────────────────────────────┤
│sendto()                       Sends data on a socket             │
├──────────────────────────────────────────────────────────────────┤
│setsockopt()                   Sets options associated with a     │
│                               socket                             │
├──────────────────────────────────────────────────────────────────┤
│shutdown()                     Shuts down all or part of a full   │
│                               duplex connection                  │
├──────────────────────────────────────────────────────────────────┤
│so_cancel()                    Cancels a pending blocking sockets │
│                               API call on a socket               │
├──────────────────────────────────────────────────────────────────┤
│sock_errno()                   Returns error code set by a socket │
│                               call                               │
├──────────────────────────────────────────────────────────────────┤
│socket()                       Creates an endpoint for            │
│                               communication and returns a socket │
│                               descriptor representing the        │
│                               endpoint                           │
├──────────────────────────────────────────────────────────────────┤
│soclose()                      Shuts down a socket and frees      │
│                               resources allocated to the socket  │
├──────────────────────────────────────────────────────────────────┤
│sysctl()                       Performs special operations on the │
│                               TCP/IP stack kernel                │
├──────────────────────────────────────────────────────────────────┤
│writev()                       Writes data from a set of specified│
│                               buffers on a socket                │
└──────────────────────────────────────────────────────────────────┘


[Back: Reference Information]
[Next: accept()]