On Wed, 3 Mar 2004, Ian Patterson wrote: > We have an application using Scott's Socktut examples to exchange data > between an iSeries program and our own PC program. > Works a treat when we know the IP address of the specific PC that runs our > program. > > In a network where the PC's have dynamically assigned IP addresses (from the > iSeries), is there any way to identify the IP address of a particular PC ? Well, first you have to decide how you're going to refer to the PCs when you don't know their IP address... obviously you can't say to the computer "hey, what's the address of that PC over by the water cooler?" I can think of two ways to refer to a PC when you don't know it's IP address, you can give it a name via DNS, or you can refer to it by MAC address. The better of the two is to use dynamic DNS. Dynamic DNS means that your DHCP server updates the DNS server each time an IP address changes. If you have a computer called "Ian" (for example) and the DHCP server changes Ian's IP address, it also tells the DNS server about the change so that the DNS server will return the new IP address. Then, your programs don't have to worry about what the IP address is, they just call gethostbyname() on the word "Ian" and the system does the work. Unfortunately, I've never used an iSeries for DHCP or DNS, so I don't know what the exact configuration directives to set up DHCP & dynamic DNS are. The second alternative is to look up the MAC address of the PC in the iSeries' ARP cache. This is a much uglier solution, and will only work if all of the PCs are on the same physical network with the iSeries. (Though, presumably they are if the iSeries is providing DHCP) There's an API that can be used to list out the ARP cache, I know I posted a sample program that uses that API somewhere... you might try searching the web. Good Luck
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.