I am using boost asio to develop a tcp server process which listens for client connections. The clients are expected to send partial packets. Server process can't process the packet until it receives the entire packet from the client (header,data and footer).
In order to handle partial packets, server process needs to push the packets( or partial packets) from each client connection to a queue. Server would maintain a queue per client connection.
Now my question is how to get a socket file descriptor when using boost asio. I am planning to use the integer value from socket file descriptor and create a std::map container that handles queue per client connection.
std::map< int, std::deque< std::string >
If retrieving socket file descriptor is not feasible what could be the alternatives for optimal performance. Do I need to use
std::map< tcp::socket *,std::deque< std::string> > ?
Thanks in advance.
There's the basic_socket::native_handle()
member function inherited by the socket classes, but you should really consider @David's answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With