Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Using socket addresses

&pagelevel(4)&pagelevel

When the bind(), connect(), getpeername(), getsockname(), recvfrom() and sendto() functions are called, a pointer to a name (address) is passed as the current parameter. Prior to this, the program has to make the name available according to the address structure of the address family used. This address structure will be different depending on the address family used.

If, at first, the address family has to be determined from the address structure in order to continue working specific to an address family, the general sockaddr structure is used.

The sockaddr structure is defined as follows in the header file <sys.socket.h> :

struct sockaddr {
  u_short  sa_family;   /* address family */
  char     sa_data[50]; /* 50 bytes for the longest address (sockaddr_iso) /*
  };

The address structures for the AF_INET and AF_INET6 address families, as well as the AF_ISO address family, are described in the following two sections.