如何得到多穴主机的多个IP地址
在网络中的多穴主机可能同时拥有多个IP地址,特别是在使用了动态主机地址分配时也很难知道主机上的IP地址是什么。下面我利用一段C程序来列举出主机上的所有IP地址。下面是具体代码:
void print_all_ip(void)
{
char szHostName[128];
const char* pszAddr;
struct hostent * pHost;
int i,j;
if( gethostname(szHostName, 128) == 0 )
{
pHost = gethostbyname(szHostName);
for( i = 0; pHost!= NULL
搜索更多相关主题的帖子:
主机 地址