473,320 Members | 2,041 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using the IPAddress class with masks?

Hi,

This is your grandmother.

I'm have a situation where I have access to an IPAddress and a mask and
need to determine if another IP address is included in the IP block
specified by former IP address and mask. The function prototype looks
something like this:

bool IsIPAddressInBlock(IPAddress neworkID,IPAddress mask,IPAddress test){
//TODO:?
}

I understand conceptually what an IP address and mask are, but I'm not
sure how to analyze the individual bits of the networkID and mask.

Granny
Jul 19 '05 #1
1 1807
I tried:

{
return (test.Address & mask.Address)==networkID.Address;
}

.... but I get compiler errors stating that the Address property is
"obsolete"?

Granny

"Grandma Wilkerson" <tu**@bottleneck.scalability.crash.dum> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
Hi,

This is your grandmother.

I'm have a situation where I have access to an IPAddress and a mask and need to determine if another IP address is included in the IP block
specified by former IP address and mask. The function prototype looks
something like this:

bool IsIPAddressInBlock(IPAddress neworkID,IPAddress mask,IPAddress test){
//TODO:?
}

I understand conceptually what an IP address and mask are, but I'm not
sure how to analyze the individual bits of the networkID and mask.

Granny

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Grandma Wilkerson | last post by:
Hi, This is your grandmother. I'm have a situation where I have access to an IPAddress and a mask and need to determine if another IP address is included in the IP block specified by former...
10
by: feel52 | last post by:
Below you'll find the code i'm working on. It's in a button click routine and hangs after 3 or 4 sometimes 5 loops done, probably in sock.receive(....). Some code was found here( on google i mean)...
1
by: Dan Kelley | last post by:
I have 2 projects - 1 Winform project that sends Udp messages using the UdpClient class when a button is clicked, and a Console application that listens for these Udp messages. If I try to use...
2
by: David Dvali | last post by:
How can I use System.Net.IPAddress class? I want assign some IP for example: 85.125.20.60
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
1
by: hamil | last post by:
I am having trouble using the TcpListener and TcpClient classes. At the end of this post is server code that runs, and a class whose purpose is described below. I need to know when the client...
2
by: O.B. | last post by:
I have a an attribute within a Serializable class that is of type System.Net.IPAddress. When I try to serialize the class, I get the following error: System.InvalidOperationException: Cannot...
1
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How might I serialize an IPAddress? I read it needs to have a default constructor so I made a wrapper class: public class IPAddressEx : IPAddress { public IPAddressEx() : base(...
3
by: KBJ | last post by:
Hi, How can I get IP address of client, which sends request to server via .net remoting? Regards, Kate
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.