开发者

Java Socket Issue

I'm gonna use Socket() constructor to create 开发者_如何学JAVAa dummy like socket.

what is the difference of using bind() and connect() to this created socket?

if i'm gonna use bind() how can i establish connection or does it directly establish connection?


With a socket you build a connection between two endpoints. One of these endpoints (the local one) is on your machine, the other endpoint (the remote one) may be anywhere.

With bind you set the address of the local endpoint. Often you don't need to do that, since your operating system will take care of the details.

With connect you set the address of the remote endpoint and start a connection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜