c# - How do I implement Traceroute using UDP? -


The ICMP is not the only way to create a traceroute. And the answer indicates that it is possible to send an UDP packet (or some other) with the lower TTL and wait for the ICMP message.

How would I go about implementing it in C #? System.IO.Sockets? TCP objects? Anyone know an easy / best way?

1 update:

TTL is killed when the following code correctly throws an exception, how can I remove information from the UDP packet back?

How do I know if I have UDP packets (there are no other applications on my host)?

  Public Zero PingUDPAsync (IPAddress _destination, short ttl) {// Assigns the locator port number arbitrarily to this constructor. UdpClient udpClient = new application (21000); UdpClient.Ttl = ttl; // udpClient.DontFragment = True; Try {udpClient.Connect (_destination, 21000); // sends a message to the host in which you are connected byte [] sendBytes = encoding ASCII.GetBytes ("Is there anyone?"); UdpClient.Send (sendBytes, sendBytes.Length); // IPandpoint Object will allow us to read datagrams sent from any source. IPPpoint RemotePointPoint = New IPPpoint (IPadation. Any, 0); // Receive block byte [] until a message returns to this socket from a remote hostBeta = udpClient.Resive (Ref RemotePointPoint); String ReturnData = Encoding. ASCII.GetString (receiveBytes); // The IPEndPoint object uses the IPEndPoint object to determine who has responded to these two hosts. The light line ("This is the message that you have received" + return data.Towstring ()); Console.light line ("This message was sent from" + + RemoteIPandPoint address.tostring ")" On their port number "+ RemoteIPandPoint.Port .Tostring ()); udpClient.Close ();} Grip (Socket Exception Socket APPLICATIONS {console.exe.example.com};} hold (exception E) {Console.WriteLine (e.ToString ())}}    

< Div class = "post-text" itemprop = "text">

Yes, System.Net.Sockets should provide you with all the primitive items that you can send to UDP / TCP packets / Received will need to be. Lots of online documentation and samples, two articles included in your question is very interesting and a good starting point :)

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -