Possible Duplicate:
What client-side situations need bind()?
I saw the server program binding to a port. Why is this not necessary for a client program?
After all client program will also be sending and receiving data.
Anyway, in which cases is calling bind() necessary? And W-H-Y?
Because it happens automatically when you connect the socket. Usually you don’t care about which local outbound port you are using in client software, in fact the only times you do care are when your netadmin has mistakenly implemented an outbound port numbering rule, which just causes problems and doesn’t solve anything.