Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help? Posted by bogdanul2003 on 24 Feb 2004 at 6:53 AM
How can i find out the IP of a network computer or the ip of all computers that are in the network?
10x

Report
Re: Help? Posted by Masterijn on 24 Feb 2004 at 2:39 PM
This message was edited by Masterijn at 2004-2-24 14:40:56

This message was edited by Masterijn at 2004-2-24 14:40:34

This message was edited by Masterijn at 2004-2-24 14:40:7

: How can i find out the IP of a network computer or the ip of all computers that are in the network?
: 10x
:
:
For a single computer you can use:
uses
  WinSock;

function LookupName(const Name: string): TInAddr;
var
  HostEnt: PHostEnt;
  InAddr: TInAddr;
begin
  HostEnt := gethostbyname(PChar(Name));
  FillChar(InAddr, SizeOf(InAddr), 0);
  if HostEnt <> nil then
  begin
    with InAddr, HostEnt^ do
    begin
      S_un_b.s_b1 := Byte(h_addr^[0]);
      S_un_b.s_b2 := Byte(h_addr^[1]);
      S_un_b.s_b3 := Byte(h_addr^[2]);
      S_un_b.s_b4 := Byte(h_addr^[3]);
    end;
  end;
  Result := InAddr;
end;













 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.