GetHostByName:<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> WSAData: TWSAData;<br> HostEnt: PHostEnt;<br> sComputerName, sIP: string;<br>begin<br> sComputername:=edit1.text;<br> WSAStartup(2, WSAData);<br> HostEnt := gethostbyname(PChar(sComputerName)); //sComputerName = 'freemail.china.com'<br> if HostEnt <> nil then<br> begin<br> with HostEnt^ do<br> sIP := Format('%d.%d.%d.%d', [Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr^[2]), Byte(h_addr^[3])]);<br><br> end;<br> WSACleanup;<br> edit2.text:=sIP;<br>end;<br>