Linux Socket Programming by Example - Warren Gay

< BACKCONTINUE >
159231153036212041242100244042145096184016146223183074028121223009001094101122125117255217075

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 in the next chapter.

< BACKCONTINUE >

Index terms contained in this section

addresses
     sockets
            binding
binding
     addresses
            to sockets
sockets
     addresses
            binding to