• 大小: 12KB
    文件类型: .cpp
    金币: 1
    下载: 0 次
    发布日期: 2021-01-11
  • 语言: C/C++
  • 标签: C语言  Ping  

资源简介

用C语言实现的ping程序 请在vc6.0下在编译,在xp下运行。

资源截图

代码片段和文件信息

#pragma comment(lib“ws2_32.lib“)
#include 
#include 
#include 
#include 
#include 

#define IP_RECORD_ROUTE 0x7
#define DEF_PACKET_SIZE 32
#define MAX_PACKET 1024
#define MAX_IP_HDR_SIZE 60
#define ICMP_ECHO 8
#define ICMP_ECHOREPLY 0
#define ICMP_MIN 8

void InitPing();
void UserHelp();
void GetArgments(int argc char** argv); 
USHORT CheckSum(USHORT *buffer int size);
void FillICMPData(char *icmp_data int datasize);
void FreeRes();
void DecodeIPOptions(char *buf int bytes);
void DecodeICMPHeader(char *buf int bytes SOCKADDR_IN* from);
void PingTest(int timeout);

typedef struct _iphdr{
unsigned int h_len:4; /*header length*/
unsigned int version:4; /*version number*/
unsigned char tos; /*type of serv

评论

共有 条评论