WEB开发网
开发学院软件开发VC 透析ICMP协议(3):应用篇ping(ICMP.dll) 阅读

透析ICMP协议(3):应用篇ping(ICMP.dll)

 2010-02-19 20:33:04 来源:WEB开发网   
核心提示:==主函数==int main(int argc, char* argv[]){WSAData wsaData;if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {return 255;}int retval = doit(argc, argv);WSACleanup();r

==================主函数==================

int main(int argc, char* argv[])
{
WSAData wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
return 255;
}
int retval = doit(argc, argv);
WSACleanup();
return retval;
}

==================头文件==================

icmpdefs.h
//ICMP.DLL 函数中需要的结构

typedef struct {
unsigned char Ttl; // Time To Live
unsigned char Tos; // Type Of Service
unsigned char Flags; // IP header flags
unsigned char OptionsSize; // Size in bytes of options data
unsigned char *OptionsData; // Pointer to options data
} IP_OPTION_INFORMATION, * PIP_OPTION_INFORMATION;
typedef struct {
DWORD Address; // Replying address
unsigned long Status; // Reply status
unsigned long RoundTripTime; // RTT in milliseconds
unsigned short DataSize; // Echo data size
unsigned short Reserved; // Reserved for system use
void *Data; // Pointer to the echo data
IP_OPTION_INFORMATION Options; // Reply options
} IP_ECHO_REPLY, * PIP_ECHO_REPLY;

联系方式: zhangliangsd@hotmail.com

上一页  1 2 

Tags:透析 ICMP 协议

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接