Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6530965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:49:12+00:00 2026-05-25T09:49:12+00:00

Apparently ICMP isn’t the only way to create a Traceroute. This and this answer

  • 0

Apparently ICMP isn’t the only way to create a Traceroute. This and this answer indicates it’s possible to send a UDP packet (or any other) with a low TTL and wait for the ICMP message.

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

Update 1:

The following code seems to correctly throw an exception when the TTL is hit. How do I extract information from the returned UDP Packet?

How do I know that the UDP packet I’m receiving is intended for me (and not some other application on my host?)

   public  void PingUDPAsync(IPAddress _destination, short ttl)
    {
        // This constructor arbitrarily assigns the local port number.
        UdpClient udpClient = new UdpClient(21000);
        udpClient.Ttl = ttl;
       // udpClient.DontFragment = true;

        try
        {
            udpClient.Connect(_destination, 21000);

            // Sends a message to the host to which you have connected.
            Byte[] sendBytes = Encoding.ASCII.GetBytes("Is anybody there?");

            udpClient.Send(sendBytes, sendBytes.Length);


            //IPEndPoint object will allow us to read datagrams sent from any source.
            IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);

            // Blocks until a message returns on this socket from a remote host.
            Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
            string returnData = Encoding.ASCII.GetString(receiveBytes);

            // Uses the IPEndPoint object to determine which of these two hosts responded.
            Console.WriteLine("This is the message you received " +
                                         returnData.ToString());
            Console.WriteLine("This message was sent from " +
                                        RemoteIpEndPoint.Address.ToString() +
                                        " on their port number " +
                                        RemoteIpEndPoint.Port.ToString());

            udpClient.Close();
        }
        catch (SocketException socketException)
        {
            Console.WriteLine(socketException.ToString());
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:49:13+00:00Added an answer on May 25, 2026 at 9:49 am

    Yes, System.Net.Sockets should provide you all the primitive objects you would need to send/receive UDP/TCP packets. Plenty of documentation and samples online, the two articles you included in your question are very interesting and a good starting point 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apparently this used to be a way in VB6 and VBA to short circuit
Apparently using the URL is no good - why is this the case, and
Apparently many people have run into this problem, but I have yet to be
Apparently Python only supports 2 minor versions (like 2.X), so that would mean Python
Apparently this Tomcat data source gets registered in JNDI. The crystal reports API will
Apparently this line of code is triggering Object expected: var bPid = (b !=
Apparently libigraph and python-igraph are the only packages on earth that can't be installed
Apparently this function in SDL_Mixer keeps dying, and I'm not sure why. Does anyone
Apparently (because the documentation doesn't say any word of this), in a .NET Transaction
Apparently this problem comes up fairly often, after reading Regular expression to detect semi-colon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.