Networking Basic question regarding accepting connection
I have a very basic question regarding accepting connections to a network server from multiple clients.
- A Server listens on port 80
- A client connects on port 80
- Server still listens for conn开发者_运维问答ections on port 80
- Another client connects on port 80
- Server accepts the connection.
Now from here on is it the duty of the programmer to find out the requested ip and keep requests as separate and handle?
PS: This is in winsock impln
Thanks,
is it the duty of the programmer to find out the requested ip
No.
and keep requests as separate and handle?
All the programmer needs to do is keep hold of the accepted socket identifier and typically run a thread to handle all its I/O. If the application needs the remote address of the peer it can get it any time via getsockname() or whatever your language RTL provides on top of it.
精彩评论