473,770 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is IP on my Subnet?

Is there an "elegant" way to determine if an IP address is on my subnet? Or
do I just compare the first 2 or 3 octets?
Apr 24 '06 #1
1 1787
The elegant way is get both the subnet address and the IP address as 32-bit
unsigned integers, and AND them together. If the result equals the subnet,
it's on the subnet.

HTH,
Tom Dacon

"Terry Olsen" <to******@hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Is there an "elegant" way to determine if an IP address is on my subnet?
Or do I just compare the first 2 or 3 octets?

Apr 24 '06 #2

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

Similar topics

1
1925
by: Nobody | last post by:
I have a website that is built around a web-application that my company purchased. My company has full ownership and administrative rights to this software and its corresponding files. It uses HTTP Basic Authentication and that cannot be changed at all (it is compiled into the web-application itself). This is my problem: We have a secure subnet (a customer of ours) that regularly uses this website and they don't want to have to log...
0
1683
by: Pierre Rouleau | last post by:
Hi all, socket.gethostbyname_ex(socket.gethostname()) will return the list of IP addresses on a the local host. I did not find any function that can be used to get the subnet mask and default gateway. Under Win32, the Win32 IP helper API provides a GetIpAddrTable() function that returns information that contain the subnet mask, but that's Win32 level, and is not portable. Is there something available in the Python library for that...
0
1352
by: Jerry Negrelli | last post by:
Does anyone know how to get the subnet of a machine in C# (without using WMI's NetworkAdapterConfiguration object)? I've queried the Active Directory to get the visible subnets -- perhaps I can use a similar approach to get machines in each subnet?? JER
6
19980
by: ohynes | last post by:
hey newbie here wondering if there is anyone out there who can help me im trying to make a c# subnet calulator using the IPAddress class i cant seem to figure out how to do all the subnet calculations now i can do them on paper but thats about it just starting to learn c sharp
1
2478
by: Glenn M | last post by:
I know how i can use request.userhostaddress to get the requesting ip address. is their any way i can get the requesting clients subnet mask also?
1
2776
by: MS Newsgroups | last post by:
Hi, does anyone have a function, or some insight in how i would go about to be able to calculate the first and last address in a IP subnet based on a network address and bits Example 192.168.1.0 / 24 Should return
3
1864
by: JamesB | last post by:
Hmm, this doesn't seem to work. I am probably tackling it completely the wrong way, but basically I want a function to receive two IP's and a subnet mask and return True if IP1 and 2 are on the same subnet, otherwise false. I have got this so far: Private Function IsSameSubnet(ByVal IPSource As String, ByVal IPDest As String, ByVal IPSubnet As String) As Boolean
4
5137
by: Morten Fagermoen | last post by:
Hi! I try to get the subnet location info using the code below found at http://msdn2.microsoft.com/en-us/library/system.directoryservices.activedirectory.activedirectorysubnet.location.aspx. But it only tells me that "instance" is used before it has been assigned a value. Can anyone tell me what to do to get my subnet location info? Public Property SubnetLocation() As String Get Dim instance As ActiveDirectorySubnet
1
2144
by: =?Utf-8?B?Q2FybG9z?= | last post by:
Guys, I have a little problem here. I have an AD domain with one DC and 2 other member servers and when I go to My Network Places and browse the network, I can seamless see a list of all workstations (my 2 member servers and my single DC) and servers. The network IP is 10.10.10.0/24 I have a second VLAN, 10.10.20.0/24 where I have another member server. I joined this member server to the domain, added a subnet in AD Sites and Services...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.