Socket Exception 10054 (connection reset by peer)

  • Thread starter Thread starter Bernd
  • Start date Start date
B

Bernd

Hello,

i have a problem with my network code.
What i want to do is, send an UDP-packet and check if i get an
icmp-reply type 3 (dest. unreachable).

the code looks like that so far:

..
..
<snip>
this.Sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
System.Net.IPEndPoint EndPoint = new System.Net.IPEndPoint(IP, i);
Sock.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, 4000);
Sock.SendTo(this.payload, this.payload.Length,
SocketFlags.None,EndPoint);
System.Net.IPEndPoint local = new
System.Net.IPEndPoint(System.Net.IPAddress.Any, 0);
System.Net.EndPoint target = (System.Net.EndPoint)local;

byte[] retPayload = new byte[1024];
int recieved = Sock.ReceiveFrom(retPayload, ref target);
<snap>
..
..

i think the problem occours here:
int recieved = Sock.ReceiveFrom(retPayload, ref target);

does anybody have an idea ?

thanks
 
Back
Top