[Mono-list] UDP and ICMP

P Oscar Boykin boykin@pobox.com
Wed, 4 Feb 2004 20:41:14 -0800

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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.

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)
in (unmanaged) /usr/local/lib/libmono.so.0 [0x400b1d7d]
in <0x00054> System.Net.Sockets.Socket:.ctor
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.

boykin@pobox.com    http://pobox.com/~boykin    jabber: johnynek@jabber.org
fingerprint=3DD250 4AD9 4544 B7D2 A17C  911D D608 D387 6718 D75F
fix copyright: http://cyberlaw.stanford.edu/lessig/blog/archives/EAFAQ.html

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.2 (GNU/Linux)