You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
x& = 1
DO
HOST ADDR(x&) TO ip&
'... store it or whatever
LOOP UNTIL ISFALSE ip&
There is a bug in HOST ADDR in that it crashes on the 6th try (or something like that), but you should only enumerate the IP list until the IP returns zero.
So until the next update you could try some of the IP-discover code posted in recent times to the Source Code forum.
A similar thing to what I want to do would be the windows
DHCP client & server. The client finds the server before
even a subnet is entered. would this be using ICMP ?
I don't know if the multi-cast covers this or not, but somehow you should be able to do an arp broad cast....this is lower than the network level...
If a cisco router is in place there is a way to use ICMP to recover all IP addresses on the subnet, but I forgot what command it is in ICMP....it would be difficult I think....maybe not...
------------------
Scott Turchin
MCSE, MCP+I
Computer Creations Software
http://www.tngbbs.com/ccs
Just tried your method at work, seemed to do the job just fine.
Only prob I had was that I forgot about the two NICs in my
machine and of course HOST ADDR picked the first one it found
which just happened to be my Static IP to the outside world.
Needless to say my ISP wasnt too happy
Any Ideas on how to use the UDP Idea but using the
subnet mask ?
Another, less resource-intensive solution is to add any host that is running your application into a multicast group, so that the message you are sending will only be picked up by those clients. It cuts down on broadcasts.
Thanx Lance,
Thats got me on the right track, never played with UDP before.
I will just have to hope that all machines in the subnet/workgroup
are using the same IP range, if not then they will just have to
enter a server IP address
One way to accomplish the task would be for the 'client' to do a UDP broadcast to a specific port, and listen to that port for a response.
A server app would listen on that port for a broadcast and respond with it's I/P address. When the client gets that response, it knows the server I/P address. If none is received after a few goes, it can assume the server role itself.
To get the broadcast address, say the machines are all addressed 192.168.0.x, the broadcast address for the segment will be 192.168.0.255.
Easy to derive with HOST ADDR:
Code:
prt& = 16000
HOST ADDR TO ip&
bip& = (ip& OR &HFF000000)
' ip& is local IP, bip is broadcast IP.
Now a UDP SEND to bip& will go to all machine on the segment.
You could also use this idea to have each machine respond with it's own I/P address to gather data, by doing another broadcast from the server.
Hiya.
Just wondering how to obtain an list of IP addresses on
a subnet/workgroup. I want my client software to get a list of
IP's in a workgroup and test each one for and active copy
of my server (rather than have a user set each workstation enter
a server IP manualy)
Trying to avoid shared drives etc !
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: