Asalam-o-Aliakum and Hi all, I am having a problem with boost udp socket. My program terminates after throwing exception "host unreachable". My questions: 1). why udp socket cares for host it should just send data out of its own port and its job is done? 2). And how it knows that host is not available if udp is connection less protocol? 3). And another simple question how to avoid program termination on this exception? Best Regards; Sami Ul Haq
I cannot comment on your program termination error.
Regarding UDP being a connectionless protocol, errors may still be returned
if the destination host is not reachable. These errors are returned via
ICMP. You can see this with Wireshark or a similar tool.
I suspect that you are calling async_connect() or connect() on your socket
and then using async_send() or send(). I haven't been using Boost for some
time now, but in my experience on other platforms, you might get the
behavior you want by using async_send_to() and send_to() instead. The
behavior in terms of receiving the ICMP errors is different when you use
the socket this way.
On Sun, Feb 2, 2014 at 11:49 PM, •°o.O sαмι O.o°•
Asalam-o-Aliakum and Hi all, I am having a problem with boost udp socket. My program terminates after throwing exception "host unreachable". My questions: 1). why udp socket cares for host it should just send data out of its own port and its job is done? 2). And how it knows that host is not available if udp is connection less protocol? 3). And another simple question how to avoid program termination on this exception?
Best Regards;
Sami Ul Haq
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
On Mon, Feb 3, 2014 at 11:41 AM, Shane Baker
I cannot comment on your program termination error.
Regarding UDP being a connectionless protocol, errors may still be returned if the destination host is not reachable. These errors are returned via ICMP. You can see this with Wireshark or a similar tool.
As Baker points out, UDP still runs over IP, which is a routing protocol. If you send packets over UDP, it usually needs to reach a specific destination. If you have no destination in mind, you may broadcast your packets instead, for any receiving interface to receive. To do this, you'd need to set the 'broadcast' option. If you do that, you probably also want to set the do_not_route option as well, to limit how far such messages would broadcast (although, practically speaking, most routers will likely prevent your broadcast packets anyway). - Trey
Thanks to both Baker and Trey, I am not using any asyn.connect or connect method in my program just using "send_to" method " socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);" My requirement is to send data to multiple specified addresses and one of them might be not available at that time so program should keep sending data to other available addresses but it terminates after throwing exception "host unreachable". Broadcast cannot be used. On Mon, Feb 3, 2014 at 10:12 PM, Joseph Van Riper < fleeb.fantastique@gmail.com> wrote:
On Mon, Feb 3, 2014 at 11:41 AM, Shane Baker
wrote: I cannot comment on your program termination error.
Regarding UDP being a connectionless protocol, errors may still be returned if the destination host is not reachable. These errors are returned via ICMP. You can see this with Wireshark or a similar tool.
As Baker points out, UDP still runs over IP, which is a routing protocol. If you send packets over UDP, it usually needs to reach a specific destination.
If you have no destination in mind, you may broadcast your packets instead, for any receiving interface to receive. To do this, you'd need to set the 'broadcast' option. If you do that, you probably also want to set the do_not_route option as well, to limit how far such messages would broadcast (although, practically speaking, most routers will likely prevent your broadcast packets anyway).
- Trey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
It's hard to be helpful without more information. Assuming that you are
getting a boost::system::system_error thrown in direct response to the
send_to() call, I would:
1. Examine your route table to see if there is a problem there.
2. Try using traceroute to your desired address.
3. Try using Wireshark to get more insight.
On Mon, Feb 3, 2014 at 12:51 PM, •°o.O sαмι O.o°•
Thanks to both Baker and Trey, I am not using any asyn.connect or connect method in my program just using "send_to" method " socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);" My requirement is to send data to multiple specified addresses and one of them might be not available at that time so program should keep sending data to other available addresses but it terminates after throwing exception "host unreachable". Broadcast cannot be used.
On Mon, Feb 3, 2014 at 10:12 PM, Joseph Van Riper < fleeb.fantastique@gmail.com> wrote:
On Mon, Feb 3, 2014 at 11:41 AM, Shane Baker
wrote: I cannot comment on your program termination error.
Regarding UDP being a connectionless protocol, errors may still be returned if the destination host is not reachable. These errors are returned via ICMP. You can see this with Wireshark or a similar tool.
As Baker points out, UDP still runs over IP, which is a routing protocol. If you send packets over UDP, it usually needs to reach a specific destination.
If you have no destination in mind, you may broadcast your packets instead, for any receiving interface to receive. To do this, you'd need to set the 'broadcast' option. If you do that, you probably also want to set the do_not_route option as well, to limit how far such messages would broadcast (although, practically speaking, most routers will likely prevent your broadcast packets anyway).
- Trey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
•°o.O sαмι O.o°•
I am not using any asyn.connect or connect method in my program just using "send_to" method " socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);" My requirement is to send data to multiple specified addresses and one of them might be not available at that time so program should keep sending data to other available addresses but it terminates after throwing exception "host unreachable".
You might want to use the send_to overload taking a boost::system::error_code& parameter which doesn't throw. But the appropriate mailing list would be boost-users, this mailing list is about developing boost libraries.
On Feb 3, 2014, at 1:41 PM, Marcel Raad
•°o.O sαмι O.o°•
writes: I am not using any asyn.connect or connect method in my program just using "send_to" method " socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);" My requirement is to send data to multiple specified addresses and one of them might be not available at that time so program should keep sending data to other available addresses but it terminates after throwing exception "host unreachable".
You might want to use the send_to overload taking a boost::system::error_code& parameter which doesn't throw.
That's right. The option is to handle the exception.
But the appropriate mailing list would be boost-users, this mailing list is about developing boost libraries.
We also don't top post and prefer real names in the sender info. See http://www.boost.org/community/policy.html for more info. ___ Rob (Sent from my portable computation engine)
participants (5)
-
Joseph Van Riper
-
Marcel Raad
-
Rob Stewart
-
Shane Baker
-
•°o.O sαмι O.o°•