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


Binding datagram sockets to port numbers

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

The server program must bind its socket to a predefined server port number, so the clients know the port to which they should send their datagrams. In the socket address structure that the server passes on the bind() call, it can specify if it will accept datagrams from the available network interfaces, or whether only from a specific network interface. This is done by setting the IP address field of the socket address structure to either INADDR_ANY, or a specific IP address.

The client program needs to bind its socket to a local address if it wants the server program to be able to return a datagram to it. In contrast to the server, the client does not need to specify a specific port number on the bind() call; an ephemeral port number chosen by the UDP protocol layer is sufficient. This is called a dynamic bind.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014