MTU Investigator using Whidbey and the Ping class

I previously posted a TraceRoute utility, this time I figured I'd do a little MTU investigator.  In most cases your MTU is going to be throttle by your local box or your DSL/Router unit, so adding this to the TraceRoute utility really isn't that good of an idea since it takes a good deal of time to run an MTU ping.  I guess you could have the algorithm start at a high number (say 1500), and then make revisions up or down depending on the result until it finds the *threshhold*.  This type of dual direction algorithm would let you find the MTU very quickly.  I went the easy route though.

Strangely enough, Whidbey still doesn't have any cool graphing controls built into Windows Forms, else I'd toss something graphical out.  I do have one more Ping utility planned though, and it focuses on a common ping scenario, so stay tuned.

class MTUPing {
    private static Ping pinger = new Ping();

    public static int PingForMTU( int startSize, int incSize, IPAddress endPoint ) {
        if ( incSize < 0 ) { incSize = -incSize; }
        if ( incSize == 0 ) { incSize = 10; }

        bool complete = false;
        while ( !complete ) {
            PingReply reply = pinger.Send( endPoint, new byte[startSize], 5000, new PingOptions( 128, true ) );
            if ( reply.Status == IPStatus.PacketTooBig ) {
                int reviseSize = startSize;
                startSize -= incSize;

                while ( startSize < reviseSize ) {
                    reply = pinger.Send( endPoint, new byte[startSize + 1], 5000, new PingOptions( 128, true ) );
                    if ( reply.Status == IPStatus.PacketTooBig ) { break; }

                    startSize++;
                }
                break;
            }
            startSize += incSize;
        }
        return startSize;
    }
}

Published Saturday, June 12, 2004 8:38 AM by Justin Rogers
Filed under:

Comments

Sunday, April 27, 2008 8:37 AM by Resveratrol

# Resveratrol

These bookmark sites allow you to share your personal bookmarks with the public. This is where the term“ social” comes into play. When you bookmark a site other people can also find the site that you bookmarked if they enter the same tag that you classified

Friday, June 27, 2008 7:02 AM by dvd decrypter software

# dvd decrypter software

scan IP address , scan your TCP/ UDP ports , scan several specifically popular TCP/ UDP ports.

Tuesday, July 01, 2008 5:03 PM by dvd burning software

# dvd burning software

The current Rio proceedings, bankrolled by yet another of those murky special UN extra- budgetary trust funds, boasting more than 1,000 participants, and complete with a UN media team, are being broadcast live at this link. I tuned in Sunday afternoon

Tuesday, July 08, 2008 6:02 AM by decoders for dvd

# decoders for dvd

After the initial ogling phase came the dissatisfaction. Not with the box and its software per se , but simply with the fact that its potential wasn’ t maximised. So it was a format and fresh install of Vista- removing all the Dell bloatware in the process

Thursday, July 24, 2008 4:01 AM by copy dvd to dvd

# copy dvd to dvd

Audio: Games: Desktop: Business: Internet: Multimedia: Guide: Software Developer: Utilities: Web Developer:

Friday, August 22, 2008 12:37 PM by buy a foreclosed house

# buy a foreclosed house

Even if you are too excited to seek for your dream home, do not just go out the market and start seeking for the right home for you, you have to make sure of your finances first. You need to apply for a mortgage if you do not have the savings to buy a

Monday, September 08, 2008 2:06 PM by passive residual income

# passive residual income

I found your site on faves.com bookmarking site.. I like it ..gave it a fave for you..ill be checking back later

Leave a Comment

(required) 
(required) 
(optional)
(required)