O'Reilly logo

Linux Socket Programming by Example by Warren W. Gay

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

Chapter 5. Binding Addresses to a Socket

The preceding chapters prepared you with the means to create sockets and to form addresses for them. This chapter will expand upon this, enabling you to understand how bind(2) works and how to apply it correctly.

In this chapter, you will learn

  • How the bind(2) function call assigns an address to a socket

  • How to obtain the local socket address from a socket that already has an existing address

  • How to obtain the peer socket address

  • How bind(2) can choose the network interface that is used for communication

Chapter 2, "Domains and Address Families," covered addresses in detail. This background will make this chapter easy for you to follow.Having mastered the bind function, you will be able to put sockets to work ...

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