回复:瑞星23.00.23.09版本,误杀apache2服务器,咋个回事?
程序源码:
#include<windows.h>
#include<winsock.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
#pragma comment(lib,"ws2_32.lib")
void print_ip(void)
{
WORD wVersionRequested;
WSADATA wsaData;
char name[255];
PHOSTENT hostinfo;
wVersionRequested=MAKEWORD(2,0);
if(WSAStartup(wVersionRequested,&wsaData)==0)
{
if(gethostname(name,sizeof(name))==0)
{
if((hostinfo=gethostbyname(name))!=NULL)
{
LPCSTR ip=inet_ntoa(*(struct in_addr*)*hostinfo->h_addr_list);
printf("%s\n",ip);
}
}
WSACleanup();
}
}
int main(int argc,char * argv[])
{
print_ip();
return 0;
}