通过ip地址能如何获得远程的计算机名(不是在局域网)

qqfqqf 2005-10-27 11:30:52
通过ip地址如何获得远程的计算机名(不是在局域网)
...全文
321 6 打赏 收藏 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
fkeumtdh 2005-11-24
  • 打赏
  • 举报
回复
四楼是对的
回复人: songhtao(三十年孤独) ( ) 信誉:131
BCB2006 2005-11-21
  • 打赏
  • 举报
回复
tracert ip
我不懂电脑 2005-11-21
  • 打赏
  • 举报
回复
gethostbyaddr

The 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.
deutsch 2005-11-20
  • 打赏
  • 举报
回复
gethostbyaddr
constantine 2005-11-19
  • 打赏
  • 举报
回复
在对方哪里写一个程序解析然后回复,可以用socket,也可以用控件,简单的通信就可以了
FengSC 2005-10-28
  • 打赏
  • 举报
回复
ping -a

1,317

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧