[b][red]This message was edited by GarryPaxton at 2004-8-14 3:20:59[/red][/b][hr]
I have a PC with a broadband connection, plus several other PCs on a LAN that share the internet connection. I created a small chat program (Delphi 6, TclientSocket, TServerSocket), but I have to type in the IP address of the PCs into my program.
I have found various bits of code that return the IP address of a PC on the LAN (ie 192.168.0.100), so my program works fine over the LAN.
However, I have yet to find a piece of code that provides the internet IP address, so that I could use my program to chat with someone else on the internet who also has a copy of my program.
As I know nothing about internet programming, perhaps you could tell me whether my approach is wrong and perhaps point me to a discussion on the subject, or could someone point me to the relevant code to determine the internet IP address, please ?
many thanks
Comments
: I have a PC with a broadband connection, plus several other PCs on a LAN that share the internet connection. I created a small chat program (Delphi 6, TclientSocket, TServerSocket), but I have to type in the IP address of the PCs into my program.
:
: I have found various bits of code that return the IP address of a PC on the LAN (ie 192.168.0.100), so my program works fine over the LAN.
:
: However, I have yet to find a piece of code that provides the internet IP address, so that I could use my program to chat with someone else on the internet who also has a copy of my program.
:
: As I know nothing about internet programming, perhaps you could tell me whether my approach is wrong and perhaps point me to a discussion on the subject, or could someone point me to the relevant code to determine the internet IP address, please ?
:
: many thanks
:
:
:
The IP address is unique across the internet. So as long as the LAN has a connection to the internet, you can use your chat program to chat with any-one across the world (providing they too have internet access).
: : I have a PC with a broadband connection, plus several other PCs on a LAN that share the internet connection. I created a small chat program (Delphi 6, TclientSocket, TServerSocket), but I have to type in the IP address of the PCs into my program.
: :
: : I have found various bits of code that return the IP address of a PC on the LAN (ie 192.168.0.100), so my program works fine over the LAN.
: :
: : However, I have yet to find a piece of code that provides the internet IP address, so that I could use my program to chat with someone else on the internet who also has a copy of my program.
: :
: : As I know nothing about internet programming, perhaps you could tell me whether my approach is wrong and perhaps point me to a discussion on the subject, or could someone point me to the relevant code to determine the internet IP address, please ?
: :
: : many thanks
: :
: :
: :
: The IP address is unique across the internet. So as long as the LAN has a connection to the internet, you can use your chat program to chat with any-one across the world (providing they too have internet access).
:
Yes, but I thought that the ranges of 192.168.0.nnn were for local LAN use only.
: : : I have a PC with a broadband connection, plus several other PCs on a LAN that share the internet connection. I created a small chat program (Delphi 6, TclientSocket, TServerSocket), but I have to type in the IP address of the PCs into my program.
: : :
: : : I have found various bits of code that return the IP address of a PC on the LAN (ie 192.168.0.100), so my program works fine over the LAN.
: : :
: : : However, I have yet to find a piece of code that provides the internet IP address, so that I could use my program to chat with someone else on the internet who also has a copy of my program.
: : :
: : : As I know nothing about internet programming, perhaps you could tell me whether my approach is wrong and perhaps point me to a discussion on the subject, or could someone point me to the relevant code to determine the internet IP address, please ?
: : :
: : : many thanks
: : :
: : :
: : :
: : The IP address is unique across the internet. So as long as the LAN has a connection to the internet, you can use your chat program to chat with any-one across the world (providing they too have internet access).
: :
: Yes, but I thought that the ranges of 192.168.0.nnn were for local LAN use only.
:
No, the first 1 or 2 bytes (I'm not sure exactly how many) define the LAN you are on. I am sure that the first 3 bytes define the subnet you are on, which in turn is part of the LAN. The last byte defines the precise place of your computer in that subnet.
For example my IP address starts with 131.211, which defines the Utrecht University LAN (or at least a part of it, again not sure).