hi All

I have written a simple program in C# to produce the ICMP Error Type 3 (Port Unreachable Error)..

I have written a simple UDP Client program that sends a message to the another system in the same network where the receiver UDP program is not running on the remote side so i should get the ICMP error message from UDP from the remote machine.

The Code snipped goes like this...

Socket UDPSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

IPEndPoint RemoteEndpoint = new IPEndPoint(IPAddress.Parse(""), 55555);

byte[] b = Encoding.ASCII.GetBytes("MyNameisNirmal");

int i=0;

while (true)





UDPSocket.SendTo(b, RemoteEndpoint);


catch(socketexception se)





the program runs infinetly with no error message...

I have checked with the Ethreal Trace and no ICMP message was returned by the remote system...But the expected result is ICMP error message 3(port Unreachable)...

Is it the Problem with Windows Socket..

Any Networking Experts plz help me on this...

Re: .NET Framework Networking and Communication Unable to get the ICMP Error Message in UDP


i have found the answer...

ICMP error message port 3 unreachable error message will be generated ..but it is only handled when using the connected Datagram sockets...