IP & Subnet

How can i get the actual IP-Address and Subnet mask (and how can i select the netwerk device if i have more than one ?)
Can i get the Computers from the Network Neighborhood ? -> Extra Points !!
snoopy_SpyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
Hi,

function GetIPAddress(name : string) : string;
var wsdata : TWSAData;
    he : PHostEnt;
    ss : pchar;
    ip : TInAddr;
begin
  WSAStartup(MakeWord(1, 1), wsdata);
  he := gethostbyname(pchar(name));
  if he<>nil then
  begin
    ip.S_addr := integer(pointer(he^. h_addr_list^)^);
    ss := inet_ntoa(ip);
    Result := string(ss);
  end;
  WSACleanup();
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit2.Text := GetIPAddress(Edit1.Text);
{where edit2 contains pc name}
end;

you want to get computer names as network neighbourhood see this demo:
http://www.delphifreestuff.com/examples/wnetexmp.zip

sorry cant help about the others.
Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intheCommented:
remember uses "Winsock" for ip address.
0
intheCommented:
mistake again
{where edit2 contains pc name}
should read
{where edit1 contains pc name}  ;-)
0
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

snoopy_SpyAuthor Commented:
Do you know how i can get the subnet mask for the network device. and how can i control for which network device i get the ip.
0
rwilson032697Commented:
Listening
0
ptmcompCommented:
Reading, too. #;-}
0
Stuart_JohnsonCommented:
Hi Barry & Ray.  Just listening too.

Stu.
0
intheCommented:
hi stu :-)

snoopy spy,
if you download this project it has the items(devices) in combobox you could strip away the code till left with just loading the devices:
http://inthe.future.easyspace.com/delphi/files/sniffer.zip

thats as far as i can help ,dont know the subnet one.

0
she3i3iCommented:
Listening
0
62ndsCommented:
see my comments for question  10330395 to get subnet mask

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.