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 socketHow 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 ...
Get Linux Socket Programming by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.