O'Reilly logo

APIs at Work, Second Edition by Ron Hawkins, Doug Pence, Bruce Vining

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the BIND API

When writing a server application that will be listening for incoming requests from a client, you need to use the Set Local Address for Socket API, BIND, to associate a local address with the socket descriptor returned by the SOCKET API. This local address represents your IP address and the port you will be using on that IP address.

Note that the BIND API is not needed when developing a client application. If BIND is not called, the system will select an available port for you. Having the system select the port for a client calling out to a server is fine, but on the server, we need to predefine a specific port, so that the clients know the port number to connect to. This is conceptually similar to how your office phone can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required