I'm writing an app that communicates with computers both inside and outside
my router. So I need to determine by the remote host's IP address if I need
to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP
and my Subnet Mask but I come up with this:
My IP: 192.168.0.14
Mask: 255.255.255.0
Result: 192.168.0.0
Should I just compare the first two octets? Or are there situations where
this would provide incorrect results? 20 1569
Terry,
AFAIK are there three ranges reserved for internal use
10.x.x.x
150.x.x.x
192.168.x.x
If I am not completely wrong than the first two should therefore be enough.
Cor
"Terry Olsen" <to******@hotma il.com> schreef in bericht
news:ug******** ******@TK2MSFTN GP05.phx.gbl... I'm writing an app that communicates with computers both inside and outside my router. So I need to determine by the remote host's IP address if I need to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP and my Subnet Mask but I come up with this:
My IP: 192.168.0.14 Mask: 255.255.255.0
Result: 192.168.0.0
Should I just compare the first two octets? Or are there situations where this would provide incorrect results?
Terry,
Sorry when I had sent it I realized me that it was not the 150 so I searched
for it in Google.
10.x.x.x
172.16.x.x - 172.31.x.x
192.168.x.x
Cor
corrrect you are.
Testing against the forst two octets should be sufficient to determine
routable vs. non routable.... aka internal/external.
NOW, if an internal network is configured to have an IP scheme with ROUTABLE
IPs ( which CAN be done --- WHY? I wouldn't know)... that would make it a
bit touchy.
--
Grumpy Aero Guy
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. .. Terry,
AFAIK are there three ranges reserved for internal use
10.x.x.x 150.x.x.x 192.168.x.x
If I am not completely wrong than the first two should therefore be enough.
Cor
"Terry Olsen" <to******@hotma il.com> schreef in bericht news:ug******** ******@TK2MSFTN GP05.phx.gbl... I'm writing an app that communicates with computers both inside and outside my router. So I need to determine by the remote host's IP address if I need to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP and my Subnet Mask but I come up with this:
My IP: 192.168.0.14 Mask: 255.255.255.0
Result: 192.168.0.0
Should I just compare the first two octets? Or are there situations where this would provide incorrect results?
The correct way is to AND both the PC's own IP address and the destination
IP address each with the subnet mask... If the result is the same, then
they are on the same subnet of the network.
Out of interest the result of AND'ing the ip address against the subnet mask
produces what is called the "Network Address". For class B addresses (such
as your example) this is simply the same as the first two octects followed
by 2 zeros, but this may not always be the case...
HTH
Simon
--
=============== =============== ==
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD
Tel: 0870 080 2300
Fax: 0870 735 0011
"Grumpy Aero Guy" <fb@beerme.or g> wrote in message
news:UZ******** *********@torna do.ohiordc.rr.c om... corrrect you are.
Testing against the forst two octets should be sufficient to determine routable vs. non routable.... aka internal/external.
NOW, if an internal network is configured to have an IP scheme with ROUTABLE IPs ( which CAN be done --- WHY? I wouldn't know)... that would make it a bit touchy.
-- Grumpy Aero Guy "Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message news:%2******** ********@TK2MSF TNGP03.phx.gbl. .. Terry,
AFAIK are there three ranges reserved for internal use
10.x.x.x 150.x.x.x 192.168.x.x
If I am not completely wrong than the first two should therefore be enough.
Cor
"Terry Olsen" <to******@hotma il.com> schreef in bericht news:ug******** ******@TK2MSFTN GP05.phx.gbl... I'm writing an app that communicates with computers both inside and outside my router. So I need to determine by the remote host's IP address if I need to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP and my Subnet Mask but I come up with this:
My IP: 192.168.0.14 Mask: 255.255.255.0
Result: 192.168.0.0
Should I just compare the first two octets? Or are there situations where this would provide incorrect results?
no please-- give more detail
On 2006-04-28, Terry Olsen <to******@hotma il.com> wrote: I'm writing an app that communicates with computers both inside and outside my router. So I need to determine by the remote host's IP address if I need to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP and my Subnet Mask but I come up with this:
My IP: 192.168.0.14 Mask: 255.255.255.0
Result: 192.168.0.0
Should I just compare the first two octets? Or are there situations where this would provide incorrect results?
I'm curious, why do you need to do this? The remote host should already
know how to respond to you. If you're sending an IP to a third host
that distributes the IP (like many P2P networks), then using the IP
address to determine local vs. remote isn't going to help you, because
you'll have conflicts with identical addresses.
> I'm curious, why do you need to do this? The remote host should already know how to respond to you. If you're sending an IP to a third host that distributes the IP (like many P2P networks), then using the IP address to determine local vs. remote isn't going to help you, because you'll have conflicts with identical addresses.
There should not be any identical addresses. I am writing a P2P application
that communicates via UDP (as an experiment, I know UDP isn't reliable for a
chat application). I want to be able to communicate with other peers both
inside and outside my router. Since there is no TCP connection from which to
read the remote IP address, when one peer sends a message to another, it
also sends the return IP address. So I need to be able to determine if the
peer is inside or outside my router so I know which IP address to send as
the return address. I won't be sending my "192.168.x. x" address to anyone
outside my router, and I should not received a private IP from anyone
outside my router.
I believe I understand now how to get the "network address" by AND'ing the
Subnet Mask with with each IP and comparing the results. I'm going to try
that.
On Fri, 28 Apr 2006 11:26:44 GMT, "Grumpy Aero Guy" <fb@beerme.or g> wrote: corrrect you are.
Testing against the forst two octets should be sufficient to determine routable vs. non routable.... aka internal/external.
NOW, if an internal network is configured to have an IP scheme with ROUTABLE IPs ( which CAN be done --- WHY? I wouldn't know)... that would make it a bit touchy.
The computers could have external static IPs that all lie on the same subnet. This most likely a few servers beloning to
one company that have brought a block of ips, etc. They now can have both their 'internal' network between each other
(internal being that they all lie on the same side of a gateway) but at the same time they are external (probaly have a
firewall though, at least I'd hope they do).
On 2006-04-29, Terry Olsen <to******@hotma il.com> wrote: I'm curious, why do you need to do this? The remote host should already know how to respond to you. If you're sending an IP to a third host that distributes the IP (like many P2P networks), then using the IP address to determine local vs. remote isn't going to help you, because you'll have conflicts with identical addresses. There should not be any identical addresses. I am writing a P2P application that communicates via UDP (as an experiment, I know UDP isn't reliable for a chat application). I want to be able to communicate with other peers both inside and outside my router. Since there is no TCP connection from which to read the remote IP address, when one peer sends a message to another, it also sends the return IP address.
I don't see where the TCP vs. UDP issue comes in. Both have the source
address in the packet.
So I need to be able to determine if the peer is inside or outside my router so I know which IP address to send as the return address. I won't be sending my "192.168.x. x" address to anyone outside my router, and I should not received a private IP from anyone outside my router.
Maybe I just don't understand the problem. I can sorta see issue in
p2p swarming apps like BitTorrent or Kazaa where a third server needs
to keep lists of distributable IP addresses and the sender address might
not match the distributable address.
In this case though, it doesn't look like that's happening. So why
can't a node receiving a packet simply reply to the sender, without the
issue of embedding a user-defined IP address in the data.
I believe I understand now how to get the "network address" by AND'ing the Subnet Mask with with each IP and comparing the results. I'm going to try that.
That's going to break on any internal network with routing. In other
words, on anything larger than a very trivial home network.
This is kinda what I'm getting at. Checking the subnet mask will
answer the question you asked, i.e., whether a transmission went through
a router. But the question you want seems to be whether a tranmission
went through a NAT router, which is a completely different question.
Of course, I'm not sure why you need the second question either... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Laphan |
last post by:
Hi All
Just wanted to know if anybody knows the answer to the following quick
queries:
1) The reason I'm using VB's INET control is to download copies of Ms Access
DBs on a range of web sites so that I have a backup. Found out from my ISP
that if my DBs go up the spout then it's down to me to restore - gulp!!!
I've created a little FTP gizmo where I could download web pages OK, but not
|
by: dartszeeland.tk |
last post by:
Hi,
i want to upload a file from my computer to a ftp.....
this is the code:
Inet.RemoteHost = "localhost" '(not ftp:// in front of it)
Inet.RemotePort = "21"
Inet.UserName = "user"
Inet.Password = "password"
|
by: Steen Gellett |
last post by:
Hallo.....I have programmed with winsock for a while, but now I have set my
eyes on Inet, but I'm totally blank........a few questions ??
Inet1.Protocol = icFTP......................I can see what this is
Inet1.RemotePort = Text4.Text......... Whats the use ??
Inet1.URL = Text1.Text....................Can this be an IP adresse
Inet1.UserName = Text2.Text........... I guess thats to connect to FTP
Inet1.Password = Text3.Text............ I...
|
by: S.W. Rasmussen |
last post by:
I have tried several times to get inet.execute to download a file with the
icHTTP protocol without much success so far.
I execute:
Inet.Execute "http://www.domain/myfolder/myfile.file", "GET"
monitor the progress in
Inet_StateChanged(ByVal State ByVal Integer)
|
by: jtmerch |
last post by:
what's the best option for using the Inet control in
VB.net? Is there a control that's built for the .net
framework that's similar to or better than the old Inet
control? I'm opening a URL and port and passing data to
that URL and port. The inet control worked fine in VB 6
for this, any ideas on VB.net? Thanks for any help.
| |
by: Pius |
last post by:
Set Inet = Server.CreateObject("InetCtls.Inet.1")
Inet.URL = "http://www.yahoo.com/"
Inet.AccessType = icDirect
Inet.Protocol = icHTTP
Inet.RemotePort = 80
Inet.RequestTimeout = 60
response.write(Inet.ResponseCode)
I got this piece of code from some forum on the web. The responsecode
is supposed to return whether the connection is sucessful (ie. got a
|
by: Rick |
last post by:
Hi,
I haven't been able to find a solution anywhere yet. I have a Vb6
application that has to be rewritten as a vb.net app and
in the old application the inet control was set as:
inet.Protocol = icHTTP
inet.OpenUrl(http://user:password@www.somesite.com/Login) format was used.
I have to take this exact same concept and accomplish it in vb.net. Has
|
by: Dan |
last post by:
I developed a website that posts data to another url via the Inet object.
I should mention that the posting code is wrapped in a VB 6 dll, and that
dll is called from ASP.
Here's the ASP code:
<%
Dim objPostWrapper
Set objPostWrapper = Server.CreateObject("MyDLL.PostWrapper")
|
by: Rick |
last post by:
Hi,
I haven't been able to find a solution anywhere yet. I have a Vb6
application that has to be rewritten as a vb.net app and
in the old application the inet control was set as:
inet.Protocol = icHTTP
inet.OpenUrl(http://user:password@www.somesite.com/Login) format was
used.
|
by: danny relic |
last post by:
Is it possible for inet to access a webpage, fill out post data, and then do another action afterwards?
How would I do that?
For instance, I've got inet accessing a site where it needs to do a POST action, then I want to have it go to a specified URL in text1.text
How can I do this?
Here's my code as of now:
|
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,...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |