Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.04.22;
Скачать: CL | DM;

Вниз

Как зная IP адрес компа в сети получить его имя?   Найти похожие ветки 

 
ctapik-net ©   (2002-01-18 13:26) [3]

Ну для меня это не так все просто, темболее ни разу этой функцией не пользовался.
Вот:
struct hostent FAR * gethostbyaddr (

const char FAR * addr,
int len,
int type
);


Parameters

addr

[in] A pointer to an address in network byte order.

len

[in] The length of the address.

type

[in] The type of the address.

Деляю так

Function GetHostNameByIP(IP : String) : String ;
Var
WSData : WSAData ;
wVersionRequested : Word ;
Len : Integer ;
P : PChar ;
HostEnt : PHostEnt ;
Begin
Result := "" ;
Try
If WSAStartup(wVersionRequested,WSData) = 0 Then Begin
Len := 260 ;
GetMem(P,Len) ;
StrPCopy(P,IP) ;
HostEnt := GetHostByAddr(P,Len,AF_INET) ;
If HostEnt<>Nil Then Begin
Result := HostEnt.h_name ;
End ;
FreeMem(P,Len) ;
End ;
Finally
WSACleanup ;
End ;
End ;

Но ничего не выходит!!!
Кстати если HostEnt <> Nil нужно освобождать из под него память или нет?



Страницы: 1 вся ветка

Текущий архив: 2002.04.22;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.016 c
3-69694
amamed_3071
2002-03-30 09:17
2002.04.22
Как увеличит TimeOut в AdoQuery


1-69932
inko
2002-04-09 15:46
2002.04.22
Значок программы в диалоге.


1-69924
Alexander Vasjuk
2002-04-09 19:48
2002.04.22
Как отключить Help по CLX


14-70008
Феликс
2002-03-16 20:43
2002.04.22
Компоненты?


3-69686
Merle Corey
2002-03-29 20:46
2002.04.22
Як сконфигурировать DCOM?