z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


AF_INET socket addresses in an Internet domain

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

A socket address in an Internet addressing family is comprised of four fields:
  • The address family (AF_INET)
  • The Internet address
  • A port
  • A character array
The structure of an Internet socket address is defined by the following sockaddr_in structure, which is found in header file IN.H:
struct in_addr
{
        u_long s_addr;
};
struct sockaddr_in
{
        short   sin_family;
        u_short sin_port;
        struct  in_addr sin_addr;
        char    sin_zero[8];
};

The sin_family field is set to AF_INET. The sin_port field is the port used by the application, in network byte order. sin_addr field specifies a 32-bit Internet address. The sin_addr field is the Internet address of the network interface used by the application; it is also in network byte order. The sin_zero field should be set to zeros.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014