如题

解决方案 »

  1.   

    一样的,都是API啦
    uses winsock;后直接用就是了
      

  2.   

    "uses winsock;后直接用就是了"来晚了
      

  3.   

    如何用啊
    比如我指定IP为'192.168.0.1'
    我想知道这个ip的主机的名字
    能给个例子吗(一小段代码,我对DElphi不是很熟悉)
      

  4.   

    function MyGetHostByAddr(const AAddress: string): string;
    var
      Host: PHostEnt;
      LAddr: Longint;
    begin
      LAddr := inet_addr(PChar(AAddress));
      Host := GetHostByAddr(@LAddr, SizeOf(LAddr), AF_INET);
      if Host <> nil then begin
        result := Host^.h_name;
      end;
    end;
      

  5.   

    function MyGetHostByAddr(const AAddress: string): string;
    var
      Host: PHostEnt;
      LAddr: Longint;
    begin
      LAddr := inet_addr(PChar(AAddress));
      Host := GetHostByAddr(@LAddr, SizeOf(LAddr), AF_INET);
      if Host <> nil then begin
        result := Host^.h_name;
      end;
    end;
      

  6.   

    AAddress应该是是什么格式(我用的是'192.168.0.2')
    但出了错