开发者

network programming management-UNIX

开发者 https://www.devze.com 2022-12-23 05:39 出处:网络
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 add

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

精彩评论

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

关注公众号