Thread: Subnet Masking

  1. #1
    lonelyp
    Guest

    Subnet Masking

    why is it that the all subnet masks only use the following nos.: 0, 128, 192, 224, 240, 248, 252, 254, 255?...e.g. 255.255.128.0

    any help would be appreciated!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Subnet Masking

    Originally posted by lonelyp
    why is it that the all subnet masks only use the following nos.: 0, 128, 192, 224, 240, 248, 252, 254, 255?...e.g. 255.255.128.0

    any help would be appreciated!
    And this has what to do with C programming in the context you've provided? Oh that's right, nothing.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    lonelyp
    Guest

    masking operaions

    i believe, from what i m learning nowadays, that masking operations are programmed...since i am only familiar with C, thought this would b a good place to start in addition to my searches on google...

    so far i have received great responses from users here and was hoping on getting some much needed advise~thats all~

    so any1 got any knowledge, please share.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I may just be unclear on what you are saying here, so bear with me. Bitmasks would be something like MessageBox(0, "hello", "world", MB_ICONQUESTION | MB_YESNO). The fourth parameter would be the mask. Since I do not know that those numbers are even bitmasks (they very well could be) I cannot really tell you what the bit values are. I do believe those are just default values.

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    why is it that the all subnet masks only use the following nos

    255 is the highest number you can store in an unsigned char. So basically, it's an easy way to store an address in 4 bytes.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #6
    Registered User zahid's Avatar
    Join Date
    Aug 2001
    Posts
    531

    Read a tutorial on IP or Subnet

    The answer of your question will not be a single line. I guess following links will give you a clear picture, of course you should have general knowledge on TCP/IP.

    IP Tutorial

    IP Subnet Calculations


    ohh.. you know this is not the right place to ask question about Network. At least you could post in GD.
    Last edited by zahid; 10-18-2002 at 10:52 PM.
    [ Never code before desk work ]
    -------------------------------------:-->
    A man who fears Nothing is the man who Loves Nothing
    If you Love Nothing, what joy is there in your life.
    =------------------------------------------------------= - I may be wrong.

  7. #7
    2 cents
    Guest
    There are 8 bits in a byte, so you have 0 to 255. Then they chopped the 256 in half, then quarters etc. for various size users, and that is why you get 128, 192, etc. If you have a 0 in the first bit, your range is 0 to 127. If you have a 1 in the first bit, and a 0 in the 2nd bit, your range is 128 to 191.

  8. #8
    2 cents
    Guest
    1's in bit position: value:
    _______________ ________
    1 128+
    1,2 192+
    1,2,3 224+
    1,2,3,4 240+
    1,2,3,4,5 248+
    1,2,3,4,5,6 252+
    1,2,3,4,5,6,7 254+
    1,2,3,4,5,6,7,8 256

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Masking input
    By bradszy in forum C++ Programming
    Replies: 15
    Last Post: 02-23-2008, 10:39 AM
  2. password masking
    By xixpsychoxix in forum C Programming
    Replies: 16
    Last Post: 03-09-2006, 03:40 PM
  3. understand masking bits
    By musikluvah in forum C++ Programming
    Replies: 2
    Last Post: 02-03-2006, 11:31 PM
  4. DIB masking
    By SAMSAM in forum Windows Programming
    Replies: 1
    Last Post: 02-03-2003, 10:22 AM
  5. Masking a surface
    By malloc(BOB) in forum Windows Programming
    Replies: 0
    Last Post: 09-05-2002, 12:49 PM