under what conditions a socket is ready for reading and writing?
A:
After the socket binds to a IP address and port, its ready to read/write. Is your question specific for any language ?
lava
2010-03-19 14:22:28
A:
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:
So here, it would be ready if it passes and on successfull connect()
.
ccheneson
2010-03-19 14:26:25