Click to See Complete Forum and Search --> : parsing the hosts file


Joerg Nowak
March 30th, 1999, 08:05 PM
I am doing some socket level connection between two devices and am using the

CSocket::Create function to establish a connection. My process is controlled by

the program that opens the connection. Currently, I have hardcoded

in an address which works fine when I only have two devices connected. However I need

to be able to interactively select my client device and check for its existence.

Conceptually I would like to parse the address out of the hosts file, display the all addresses

list box, and then select the target address in the list box. Since the hosts file is

a text file, it can have comments and other non address information which could cause my

listing to be invalid.

Does anyone have a class that will allow one to parse the host file to get the

IP addresses, or have a different method by which one can deterime the available

IP addresses on a LAN, by doing some type of lookup.

Once I get a valid address, I intend to use that address to open a socket.


Any help is appreciated


Joerg