tags:

views:

62

answers:

1

Does Socket.Bind be necessary for every situation? If no, what are the situation in which Socket.Bind must be used? Any help? Thanks.

A: 

Every situation? No. It is required for servers, they need to call Listen() and that's meaningless unless Socket knows what IP-address to listen on. Clients only have to call Connect(), that takes an IP-address.

The TcpListener class hides the Bind() call for you.

Hans Passant
Thanks for your help. Actually, I want know the exact meaning of Bind()? Why Server needs Bind()?
Jollian
@Jollian: I specifically addressed this in my answer. I don't know how to make it any clearer if you don't explain why that wasn't clear.
Hans Passant
OK. Maybe I asked a improper question, but your answer is right. Sorry for making you confused.Thank you all the same.
Jollian