|
|
|
Помогите определить имя компьютера по IP дресу
|
|||
|---|---|---|---|
|
#18+
Здравствуйте! У меня есть небоьшая проблема (может и большая) с определением имени компьютера по IP адресу.Вообщем суть программы такая: я ввожу IP адрес в текстовое поле нажимаю кнопку, мне выдается сообщение в сети компьютер или нет, и если компьютер в сети то выдается имя компьютера. Вобщем определение в сети ли компьютер я реализовал при помощи Ping() а вот получить имя никак не получается , если кто то знает подскажите пожалуйста! Забыл сказать я пишу на Билдере 6-м. Ещеб было бы неплохо, если б подсказали как отправить сообщение на компьютер.Я смотрел на форуме есть посылка сообщений через нет сенд, но у меня почемута не получилось так сделать, и так делать не хотелось бы т.к. служба отправки сообщений не у всех активирована, поэтому если кто то знает другой путь отправки сообщения пожалуйста отпишите. Зарание спасибо! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.11.2006, 11:28 |
|
||
|
Помогите определить имя компьютера по IP дресу
|
|||
|---|---|---|---|
|
#18+
gethostbyaddr(...) ping -a ip_addr Имя компьютера линукс без самбы не определишь. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.11.2006, 11:36 |
|
||
|
Помогите определить имя компьютера по IP дресу
|
|||
|---|---|---|---|
|
#18+
Akhgethostbyaddr(...) ping -a ip_addr Имя компьютера линукс без самбы не определишь. Хм , чтото я не очень понял, можна по подробнее gethostbyaddr(...) за что отвечает эта функция, и какие у нее параметры ? Извените если пишу какието глупости ,я не очень разбираюсь в этом, просто поросили написать. Ну я думаю в моем случае линукс ни у кого нет. Спасибо. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.11.2006, 11:45 |
|
||
|
Помогите определить имя компьютера по IP дресу
|
|||
|---|---|---|---|
|
#18+
winsock2.h he Windows Sockets gethostbyaddr function gets host information corresponding to an address. 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. Remarks gethostbyaddr returns a pointer to the following hostent structure which contains the name(s) and address which correspond to the given address. All strings are null terminated. Return Values If no error occurs, gethostbyaddr returns a pointer to the hostent structure described above. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError. Error Codes WSANOTINITIALISED A successful WSAStartup must occur before using this function. WSAENETDOWN The network subsystem has failed. WSAHOST_NOT_FOUND Authoritative Answer Host not found. WSATRY_AGAIN Non-Authoritative Host not found, or server failed. WSANO_RECOVERY Nonrecoverable error occurred. WSANO_DATA Valid name, no data record of requested type. WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function. WSAEAFNOSUPPORT The type specified is not supported by the Windows Sockets implementation. WSAEFAULT The addr argument is not a valid part of the user address space, or the len argument is too small. WSAEINTR The (blocking) call was canceled through WSACancelBlockingCall. See Also gethostbyname, hostent, WSAAsyncGetHostByAddr ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.11.2006, 11:50 |
|
||
|
Помогите определить имя компьютера по IP дресу
|
|||
|---|---|---|---|
|
#18+
авторThis structure is allocated by Windows Sockets. An application should never attempt to modify this structure or to free any of its components. Furthermore, only one copy of this structure is allocated per thread, and so the application should copy any information that it needs before issuing any other Windows Sockets API calls. struct hostent { char FAR * h_name; char FAR * FAR * h_aliases; short h_addrtype; short h_length; char FAR * FAR * h_addr_list; }; Members h_name Official name of the host (PC).If using the DNS or similar resolution system, it is the Fully Qualified Domain Name (FQDN) that caused the server to return a reply. If using a local "hosts" file, it is the first entry after the IP address. h_aliases A NULL-terminated array of alternate names. h_addrtype The type of address being returned. h_length The length, in bytes, of each address. h_addr_list A NULL-terminated list of addresses for the host. Addresses are returned in network byte order.The macro h_addr is defined to be h_addr_list[0] for compatibility with older software. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 23.11.2006, 11:51 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=34149526&tid=2029979]: |
0ms |
get settings: |
8ms |
get forum list: |
13ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
41ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
31ms |
get tp. blocked users: |
1ms |
| others: | 220ms |
| total: | 327ms |

| 0 / 0 |
