Ask the Expert

Performing binary calculation on the IP address

I am developing a program in Visual Basic.NET for a class that I am taking and I would like to see if I can get some guidance. What I am doing is developing a program where I can take a class A,B, or C IP address and Subnet form that address. I will need to verify subnet masks, and develop the formula to Subnet. I am new to this and have reached a barrier here on this portion of the program. Any help would be greatly appreciated.

Requires Free Membership to View

I'm not exactly sure what the goal of the application is, because I'm not sure what you mean by "formula to subnet." Well, I'm sure they want you to perform some binary calculation on the IP address. Your best bet is probably to use, and possibly extend, the System.Net.IPAddress class. Here's the related page in MSDN:

You can use the IPAddress.Parse() method to accept a standard x.x.x.x IP address format, and then use GetAddressBytes() to get the IP address' four bytes for binary processing.

This was first published in April 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: