![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как в сети по IP адресу узнать имя машины? [D6, Win95/98, WinXP]
moor38 © (2004-03-12 18:23:00)Как в сети по IP адресу узнать имя машины?
Raptor (2004-03-18 17:06:00) [1]В приложении к Indy:
procedure TForm1.IdTCPServer1Connect(AThread: TIdPeerThread);
var IP : string;
SockAddrIn : TSockAddrIn;
Size : Integer;
HostEnt : PHostEnt;
begin
IP:=AThread.Connection.Socket.Binding.PeerIP;
Size:=SizeOf(SockAddrIn);
getpeername(AThread.Connection.Socket.Binding.Handle, SockAddrIn, Size);
HostEnt:=gethostbyaddr(@SockAddrIn.sin_addr.s_addr, 4, PF_INET);
ListBox1.Items.Add(IP+' - '+HostEnt.h_name)
end;
Rouse_ (2004-03-12 20:24:00) [2]http://www.delphimaster.ru/cgi-bin/download.pl?look=1&id=1078646471&n=1
moor38 (2004-03-12 19:47:00) [3]что-то на эту структуру ма...ся delphi
ki11er (2004-03-12 18:48:00) [4]struct HOSTENT FAR * gethostbyaddr(
const char FAR *addr,
int len,
int type
);
addr
[in] Pointer to an address in network byte order.
len
[in] Length of the address.
type
[in] Type of the address, such as the AF_INET address family type (defined as TCP, UDP, and other associated Internet protocols). Address family types and their corresponding values are defined in the Winsock2.h header file.
moor38 (2004-03-12 18:46:00) [5]не понял
ki11er (2004-03-12 18:43:00) [6]Ну так и дай на вход адрес той машины, для которой хочешь узнать
moor38 (2004-03-12 18:39:00) [7]нет не моей тачки, а удаленно другой находящейся в сети
ki11er (2004-03-12 18:35:00) [8]gethostbyaddr