udp client: destination port unreachable question

V

vlyamtsev

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,
 
E

Esmond Pitt

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?

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top