微软ping程序源代码完整版
日期:2007年9月5日 作者: 查看:[大字体 中字体 小字体]-
}
timeout = 1000;
bread = setsockopt(sockRaw,SOL_SOCKET,SO_SNDTIMEO,(char*)&timeout,
sizeof(timeout));
if(bread == SOCKET_ERROR) {
fprintf(stderr,"failed to set send timeout: %d\n",WSAGetLastError());
ExitProcess(STATUS_FAILED);
}
memset(&dest,0,sizeof(dest));
hp = gethostbyname(argv[1]);
if (!hp){
addr = inet_addr(argv[1]);
}
if ((!hp) && (addr == INADDR_NONE) ) {
fprintf(stderr,"Unable to resolve %s\n",argv[1]);
ExitProcess(STATUS_FAILED);
}
if (hp != NULL)
memcpy(&(dest.sin_addr),hp->h_addr,hp->h_length);
else
dest.sin_addr.s_addr = addr;
if (hp)
dest.sin_family = hp->h_addrtype;
else
dest.sin_family = AF_INET;
dest_ip = inet_ntoa(dest.sin_addr);
//
// atoi函数原型是: int atoi( const char *string );
// The return value is 0 if the input cannot be converted to an integer !
//
if(argc>2)
{
times=atoi(argv[2]);
if(times == 0)
times=DEF_PACKET_NUMBER;
}
else
times=DEF_PACKET_NUMBER;
if (argc >3)
{
datasize = atoi(argv[3]);
if (datasize == 0)
datasize = DEF_PACKET_SIZE;
if (datasize >1024) /* 用户给出的数据包大小太大 */
{
fprintf(stderr,"WARNING : data_size is too large !\n");
datasize = DEF_PACKET_SIZE;
}
}
else
datasize = DEF_PACKET_SIZE;
datasize += sizeof(IcmpHeader);
icmp_data = (char*)xmalloc(MAX_PACKET);
recvbuf = (char*)xmalloc(MAX_PACKET);
if (!icmp_data) {
fprintf(stderr,"HeapAlloc failed %d\n",GetLastError());
ExitProcess(STATUS_FAILED);
}
memset(icmp_data,0,MAX_PACKET);
fill_icmp_data(icmp_data,datasize);
//
//显示提示信息
//
fprintf(stdout,"\nPinging %s ....\n\n",dest_ip); - 上一页 [1] [2] [3] [4] [5] [6] 下一页
-
- 微软ping程序源代码完整版 相关文章:
- ·微软会发布Win Server 2008 RC2?
- ·微软官网Microsoft.com安全防护趣闻
- ·下载:MSN微软官方圣诞表情包
- ·深入了解微软Windows 7系统
- ·微软Live Search地图服务中文版上线
- ·微软推中文版地图Live Search服务
- ·微软问答录 到底WHS是干啥的?
- ·Win XP SP3 RC1微软官方下载
- ·微软发布2007年最后7个安全补丁
- ·微调Vista“用户帐户控制”功能
- 微软ping程序源代码完整版 相关软件
- ·《冰封王座》地图:微雨传奇 1.7
- ·蒙娜丽莎的微笑
- ·《微笑娃娃》解密试玩
- ·手机游戏:动物园大亨(微软正版)
- ·《细致入微的战争铅笔画》
- ·显微镜下的雪花(图集)
- ·微软IE网络霸业十年回眸
- ·俗世奇人(冯骥才微型小说集)
- ·微软Visio绘图工具
- ·微型小说写作讲座
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
上一篇:从博客说起 网络新模式愚人娱人
精品推荐
热点TOP10
特别推荐
- ·用net start 可以启动的服务命令一览
- ·Linux阅读材料
- ·掌握IP地址知识 子网掩码与子网划分
- ·ADSL共享方案及实例操作
- ·2000/XP中无法删除文件的解决办法
- ·最全面的密码破解以及抗击手段大曝光
- ·两台电脑直连的方法
- ·电子邮件头解析
- ·密码遗忘通关手册
- ·Regsvr32的特殊作用
- ·收藏经典:windows消息大全
- ·nslookup-ipconfig基础网络命令
- ·网络硬盘数据保护及还原精灵实战
- ·巧用net命令进行局域网文件批量同步更新
- ·打造WIN2000/XP/2003系统万能克隆
- ·菜鸟必知 shift键十大密招大公开
- ·快速批量绑定MAC与IP地址
- ·98/2000/XP密码恢复方法
- ·还原精灵之另类破解
- ·查看内存是否处于双通道模式
