title: Why is bind() used in TCP? Why is it used only on server side and not in client side?
body: <p>I wanted to know the exact function of bind() in TCP. What does it mean by 'binding' a local address to the socket? If it's assigning a port number to the socket, then why don't we use it in the client? I know that port is assigned by OS automatically in the client side, but I'm not getting the big picture of how all of this works.</p>
  
  <p>After bind(), we listen(). How is the bind related to listen()? Will the listen() know that bind() has been executed? If so, what changes does bind() make so that it is known? I mean, how does returning zero for successful execution help?</p>
  
  <p>I've gone through many definitions, but no where I could get all of this in detail. So if anyone can please explain this to me, I will be grateful.</p>