?? main.cpp
字號:
#include "stdafx.h"
#include "ping.h"
void _tmain(int argc, TCHAR *argv[])
{
if (argc != 2)
{
printf("You must specify who you want to ping on the command line\n");
return;
}
#ifdef CPING_USE_ICMP
{
CPing p1;
CPingReply pr1;
if (p1.Ping1(argv[1], pr1))
{
hostent* phostent = gethostbyaddr((char *)&pr1.Address.S_un.S_addr, 4, PF_INET);
printf("%d.%d.%d.%d [%s], replied in RTT:%dms\n",
pr1.Address.S_un.S_un_b.s_b1, pr1.Address.S_un.S_un_b.s_b2, pr1.Address.S_un.S_un_b.s_b3,
pr1.Address.S_un.S_un_b.s_b4, phostent->h_name, pr1.RTT);
}
else
printf("Failed in call to ping, GetLastError returns: %d", GetLastError());
}
#endif
#ifdef CPING_USE_WINSOCK2
{
CPing p2;
CPingReply pr2;
if (p2.Ping2(argv[1], pr2))
{
hostent* phostent = gethostbyaddr((char *)&pr2.Address.S_un.S_addr, 4, PF_INET);
printf("%d.%d.%d.%d [%s], replied in RTT:%dms\n",
pr2.Address.S_un.S_un_b.s_b1, pr2.Address.S_un.S_un_b.s_b2, pr2.Address.S_un.S_un_b.s_b3,
pr2.Address.S_un.S_un_b.s_b4, phostent->h_name, pr2.RTT);
}
else
printf("Failed in call to ping, GetLastError returns: %d", GetLastError());
}
#endif
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -