I saw at some point a suggestion that I may use multiple ioservice threads
for scalability. Is there a way to use same udp socket on multiple threads
Post by Jeff Koftinoff"reuse port" and "reuse address" are not useful in this situation and are
not used for this purpose.
A single async_receive_from call will receive from any client. The
callback will tell you the address of the sender.
A single async_send_to call will send to any client.
Yes you may have only one pending at a time, but this is what you need to use a queue for.
Regards,
Jeff
Thanks for prompt replay Jeff. I see that normal UDP API could use option
"reuse port" but ASIO only has
boost::asio::socket_base::reuse_address
The problem with the approach mentioned by you is that in this case on multiple clients requests (and time needed on each one for processing) I cannot simultaneously "async_receive_from" (for reading more requests),
and "async_send_to" (for sending back responses as they are available). How I am going to have scalability ?
Best regards
-Ghita
Post by Jeff KoftinoffHello Ghita
You are not to use different sockets for this purpose.
You are not to use bind for sending to a client.
You are to use send_to() with the existing server socket. One of the
parameters of send_to() is the address of the client you are sending to.
Remember that if you are using async_send_to() you can not call it again
on the same socket until the first async_send_to() was signalled as
completed.
Regards,
Jeff
Hy.
I've been looking for some days for a resolution to this.
socket(ioService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), port))
and if I try to create another socket on same port (used for sending
datagrams from same server port *but* to different clients endpoint) I get
bind errors (asio throws exception)
Is there a way to do this ? This must be a common use case, sending
datagrams to multiple clients using same server port...
Thanks
-Ghita
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
asio-users mailing list
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
asio-users mailing list
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio