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
2010-03-19 12:28:24
Thanks for your help. Actually, I want know the exact meaning of Bind()? Why Server needs Bind()?
Jollian
2010-03-19 12:59:02
@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
2010-03-19 14:10:36
OK. Maybe I asked a improper question, but your answer is right. Sorry for making you confused.Thank you all the same.
Jollian
2010-03-20 08:16:55