Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.44 MB
Время: 0.014 c
3-69702
don1780
2002-03-29 04:13
2002.04.22
Уважаемые, помогите начинающему!


14-69988
Hel
2002-03-14 13:54
2002.04.22
---|Ветка была без названия|---


14-70026
Esa
2002-03-18 13:40
2002.04.22
AccessViolation


1-69784
$hiC0
2002-04-10 11:25
2002.04.22
Print и PrintDialog


3-69699
Jaric
2002-03-30 14:26
2002.04.22
Как общаться через ADO компоненты через SPX/IPX протокол?




   Наверх