[Boost.Asio] Udp::Socket->send_to

Hi, In using the Boost.Asio library, the Udp::Socket->send_to() function throws an error if the endpoint is unreachable. I thought in udp datagrams its a send and forget mentality. The send_to function would send the message even if the endpoint was unreachable. Is there a setting I need to use for this to work? Ryan

Hi,
In using the Boost.Asio library, the Udp::Socket->send_to() function throws an error if the endpoint is unreachable. I thought in udp datagrams its a send and forget mentality. The send_to function would send the message even if the endpoint was unreachable. Is there a setting I need to use for this to work?
Ryan
This probably means you don't have a route to the target host, so your kernel returns with error from local TCP stack without actually putting packet on the wire. Hope this helps. -- Nikolai

Ryan McConnehey wrote:
Nikolai N Fetissov wrote:
Hi,
Ryan McConnehey wrote:
In using the Boost.Asio library, the Udp::Socket->send_to() function throws an error if the endpoint is unreachable. I thought in udp datagrams its a send and forget mentality. The send_to function would send the message even if the endpoint was unreachable. Is there a setting I need to use for this to work?
This probably means you don't have a route to the target host, so your kernel returns with error from local TCP stack without actually putting packet on the wire.
I thought udp didn't need a route to the target host. As long as there is a connection to a hub the socket > would send the data out. Don't a route to the target host mean tcp?
No, UDP/IP still needs the route. It doesn't verify the destination is actually available or attempt any form of two-way communication, but it does need to determine which router will get the packet closer to its destination.

I thought udp didn't need a route to the target host. As long as there is a connection to a hub the socket would send the data out. Don't a route to the target host mean tcp?
UDP is a transport protocol. Routing happens one step bellow at the network (i.e. IP) level. End-nodes (not routers) with single network connection have very simple routing tables and usually work off a default route/ default gateway in a way "I don't know where this packet needs to go so let the router I'm connected to figure this out". This is *not* the same as having an ethernet cable from your machine to a switch - some routing setup still needs to be done (either automatically via dhcp or manually.) Make yourself familiar with netstat, route, and traceroute commands, or, even better, pick up a copy of "TCP/IP Illustrated" Vol.1 by W. Richard Stevens (http://www.kohala.com/start/tcpipiv1.html) to get a better understanding of networking. Hope this helps. -- Nikolai
participants (3)
-
Andrew Holden
-
Nikolai N Fetissov
-
Ryan McConnehey