|
Boost Users : |
Subject: [Boost-users] Using boost::Asio for connected UDP socket
From: Gheorghe Marinca (gheorghe.marinca_at_[hidden])
Date: 2012-08-27 15:54:32
Hi,
I want to implement an UDP server and have problems on defining on how the
server handles coming concurrent udp "connections" from multiple clients.
What I basically want to implement is an DNS proxy.
Is there something equivalent to an tcp::acceptor for udp ? Looking over
asio docs I see:
template<
typename Protocol
<http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/Protocol.html>,
typename SocketAcceptorService
<http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/SocketAcceptorService.html>
= socket_acceptor_service<Protocol>>class basic_socket_acceptor :
public basic_io_object< SocketAcceptorService >,
public socket_base
For tcp we have following typedef:
typedef basic_socket_acceptor< tcp > acceptor;
Can I use basic_socket_acceptor with socket_acceptor_service<UDP> so that I
can create additional udp sockets for every udp client that wants to send
data to my server ?
I've observed that if I use async_receive_from on the same socket I receive
data from multiple clients making impossible exchanging data (read/write)
with multiple clients at the same time.
Any hints are appreciated.
-Ghita
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net