[Mono-list] UDP and ICMP

Marco Canini marco.canini@fastwebnet.it
Thu, 05 Feb 2004 11:21:15 +0100


On Thu, 2004-02-05 at 05:41, P Oscar Boykin wrote:
> Hello All.
> 
> I am using using mono to send udp packets between two hosts.  At some
> point, one host may go offline.  If I watch the network (using ethereal)
> I see the UDP packet go from A->B, and host B responds with a ICMP
> destination unreachable packet.  However, I don't see how I can get
> access to that packet in my application.
Sorry but if B goes down how do you see the ICMP packets from B?

Anyway you can make B send UDP packets to A as an acknowledge, setting a
timeout to wait for B responses in A

> 
> I was hoping that SendTo or ReceiveFrom could throw exceptions, but I
> don't believe that is how they work.
> 
> I also tried to make a separate socket to listen for the ICMP packets,
> but under Linux and Mono 0.30, I get an exception when I try to create
> the socket to listen for ICMP messages:
> 
> Unhandled Exception: System.Net.Sockets.SocketException: Access denied
> in (unmanaged) /usr/local/lib/libmono.so.0(mono_raise_exception+0x1f)
> [0x4009176f]
> in (unmanaged) /usr/local/lib/libmono.so.0 [0x400b1d7d]
> in <0x00054> System.Net.Sockets.Socket:.ctor
> (System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType)
> in <0x000d3> Gnucla.UdpEdgeListener:.ctor (int)
> in <0x001b0> Gnucla.EchoTest:Main (string[])
> 
> Can anyone suggest a method that host A can see that host B is no longer
> listening without doing it at the application layer?  I just want the
> ICMP packet to have an effect.
> 
> Thanks.
> POB
-- 
Marco Canini <marco.canini@fastwebnet.it>