[asio-users] Boost asio - udp server
Brought to you by:
chris_kohlhoff
From: Gheorghe M. <ghe...@gm...> - 2012-08-28 08:38:39
|
I saw the official async udp server example from boost doc. There you create a single udp socket, bind it to a local port and do something like this: socket(ioService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), port)) socket.async_receive_from(buffer(data, max_length), senderEndpoint, boost::bind(&Request::HandleReceiveFrom, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); How can I handle multiple concurrent udp connections from clients, because if I try to create another socket using socket(ioService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), port)) i get bind errors because I already have a socket bound to the same port Some more about the udp server I want to implement. I use my server as a dns proxy. I want to handle multiple clients, proxy their requests, and give answers back. If I could use something like tcp acceptor, but for udp that would simplify things as I see them now. Best regards, -Ghita |