Hello,
My question is concerned with java.net package. I used trivial
UDPClient example to send datagrams from local interface eth1 on Linux
to the ip host not included into local route table and I tried to
capture outgoing udp traffic on interface eth1. I've got IOException
"ICMP: destination unreachable" and I only could capture outgoing
packets on loopback interface ( with Ethereal). Can someone help to
resolve my confusion: I thought UDP is "connectionless", e.g. will be
sent regardless. What does ICMP have to do with it and why does this
traffic appear on loopback interface?
Thank you,
Esmond Pitt - 13 May 2007 04:53 GMT
> Hello,
> My question is concerned with java.net package. I used trivial
[quoted text clipped - 6 lines]
> sent regardless. What does ICMP have to do with it and why does this
> traffic appear on loopback interface?
err, because the destination host is unreachable? Where would you expect
UDP to send the packet *to* if there is no unicast route to the target?
You get the ICMP response if you have used DatagramSocket.connect(). If
you avoid that and put the destination address into the DatagramPacket,
you won't get the exception, but the packet still won't go out as there
is no unicast route. If that's what you want.