开发者

network programming management-UNIX

under what conditions a socket is ready for readin开发者_JAVA技巧g and writing?


Have a look at the excellent Beej's guide to network programming here. Worthy read...


After the socket binds to a IP address and port, its ready to read/write. Is your question specific for any language ?


On a server, you would usually do in order:

  • socket() - Create socket
  • bind() - Bind the socket to a specific port
  • listen() - Listen for incoming request
  • accept() - Accept the request

So, in this situation, your socket would be ready for reading and writing after passing and on successful accept()

On a client side:

  • socket() - Create socket
  • connect() - Make connection to another peer

So here, it would be ready if it passes and on successfull connect().

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜