 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bo Berglund Guest
|
Posted: Tue Feb 14, 2006 12:03 am Post subject: How can I read the netmask of my network using Delphi7? |
|
|
I want to find out on which network the PC which runs my software is
connected.
Specifically I need to find the netmask value. I know how to get the
IP address, but not the netmask.
The reason is that I want to connect to a perticular port server
(hardware gadget) on the network and I can broadcast a UDP command to
make them all report their presence. This way I can get their IP
address and a name property too.
But in order to reach them by TCP socket communication I need to
verify if their IP address is actually within my own PC:s network.
This will be done by anding the IP address of the portserver (received
from the broadcast) and the IP of my own PC with the netmask and
compare the results. If they are the same then I can go ahead and work
with the port server.
So the netmask is important to retrieve, but how?
I use the Indy 9 UDP client component to broadcast the report command.
Is there a way using Windows API or Indy9 to retrieve the netmask on
my own PC?
/Bo |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 14, 2006 12:03 am Post subject: Re: How can I read the netmask of my network using Delphi7? |
|
|
"Bo Berglund" <bo.berglund (AT) telia (DOT) com> wrote in message
news:4n42v114u4fa3no3gv593lgce6tvligu5a (AT) 4ax (DOT) com...
| Quote: | I want to find out on which network the PC which runs
my software is connected.
|
You have to query the network adapters directly for that. Look at the
GetAdaptersInfo() function in the Win32 API:
GetAdaptersInfo
http://msdn.microsoft.com/library/en-us/iphlp/iphlp/getadaptersinfo.asp
| Quote: | Is there a way using Windows API or Indy9 to retrieve the
netmask on my own PC?
|
There is nothing in Indy for that.
Gambit |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|