Boost logo

Boost Users :

Subject: [Boost-users] Asio acceptor : Multiple client connections on single port
From: Amit Sonawane (asonawane_at_[hidden])
Date: 2008-11-11 06:25:23


I have a acceptor server which listens to various connections from
clients. It creates one server object per client connection. I need the
clients to connect to only one IP port of the server. Following the
examples in boost I do this:

(sample code)

 

boost::asio::ip::tcp::acceptor m_acceptor;

boost::asio::ip::tcp::resolver resolver(iosvr);

boost::asio::ip::tcp::resolver::query
query(host.c_str(),boost::lexical_cast<std::string>(port));

boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);

                  

m_acceptor.open(endpoint.protocol());

 

m_acceptor.set_option(boost::asio::socket_base::reuse_address(true));

 

if( bNoDelay )

      m_acceptor.set_option(boost::asio::ip::tcp::no_delay(true));

else

m_acceptor.set_option(boost::asio::ip::tcp::no_delay(false));

 

m_acceptor.bind(endpoint);

m_acceptor.listen();

 

At runtime the server listens to one and only one client connection, the
others are not connected at all.

 

What is wrong in the implementation? OR How do I make acceptor to accept
multiple connections on the same server port?

 

Any help is highly appreciated.

Esta mensagem pode conter informação confidencial e/ou privilegiada. Se você não for o destinatário ou a pessoa autorizada a receber esta mensagem, não deverá utilizar, copiar, alterar, divulgar a informação nela contida ou tomar qualquer ação baseada nessas informações. Se você recebeu esta mensagem por engano, por favor avise imediatamente o remetente, respondendo o e-mail e em seguida apague-o. Agradecemos sua cooperação.

This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, change, take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.



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