欢迎来到天天文库
浏览记录
ID:30892297
大小:141.76 KB
页数:20页
时间:2019-01-04
《微软ping程序源代码完整版》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、微软Ping程序源代码完整版MicrosoftpingprogramsourcecodecompleteversionAuthor:HouZhijiangWriteaPingprocedures,canbesaidtobethefirststeptowardsmanynetworkprogramming!!thesourcecodeofthepingprogramafterImodifyanddebug,basicallycanreplacethepingprogramwithwindows・EachmoduleIhavedeta
2、ilednotesandmodifythelog,wehopetobeabletohelpinlearning!!Thisprogram/mainsourcecodefromtheMSDNwebsite,theauthorjustmadesomeimprovementsandnotes!AlsoneedtopayattentiontoisbeforeBuild,mustjointhews232.liblibraryfile,otherwiseitwillprompt"errorLNK2001:"error!*//sixsixsix
3、sixsixsix/XJSXJSXJSxpxxpxXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTXXTX✓jX彳UsixXJSXJSXJSXJS✓JXxTxVersion1.1revisionhistory:<1>sockettosolvetheblockingproblem,whichcanbehandledcorrectlyrequest!Version1.2:modifyrecords<1>addedbyfunction(i.e.theusercontrolthenu
4、mberofICMPpacketsthecommandofthesecondparameters).<2>increasedthestatisticalfunctionofPingresults>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^>1^^lz^lzsl^>1^>1^>1^>izviz#r^#7%^7^^Tx^Tx^7^^7^^T%#T^#T^^7^^ix^Tx^TxZFxZF^#T^Zjx#Tx✓?%5、T%✓?%#Tx#T^#T^#T^#T^#T^#T^^TxZjxZj%#T^#T^#T^#T^#T^#T^>r%#T^#ix⑰、"卜/I#pragmapack(4)#inelude#include#include^defineICMP_ECH08^defineICMP_ECHOREPLY0#defineICMP_MIN8byteICMPpacket//minimum8(justheader)TheIPheader/**/Typedefstructiphdr{Unsignedinth_len:4oftheheader;//lengt6、hUnsignedintversion:4;//VersionofIPUnsignedcharTOS;//TypeofserviceUnsignedshorttotal_lenlengthofthepacket;//totalUnsignedshortident;//uniqueidentifierUnsignedshortfrag_and_flags;//flagsUnsignedcharttl;Unsignedcharproto;//protocol(TCPUDPetc)Unsignedshortchecksum;//IPch7、ecksumUnsignedintsourcelP;UnsignedintdestIP;}IpHeader;ICMP//headerTypedefstructicmphdr{BYTEi_type;BYTEicodetypesubcode;/**/USHORTi_cksum;USIIORTi_id;USHORTi_seq;ThisisnottheSTD/headerbutwereservespacefortime・ULONGtimestamp;}IcmpHeader;^defineSTATUS_FAILEDOxFFFF^define8、DEF_PACKET_SIZE32Thenumberof^defineDEF_PACKET_NUMBER4/**/senddatagrams^defineIAX_PACKET1024#definexmalloc(s)HeapAlloc(GetPr
5、T%✓?%#Tx#T^#T^#T^#T^#T^#T^^TxZjxZj%#T^#T^#T^#T^#T^#T^>r%#T^#ix⑰、"卜/I#pragmapack(4)#inelude#include#include^defineICMP_ECH08^defineICMP_ECHOREPLY0#defineICMP_MIN8byteICMPpacket//minimum8(justheader)TheIPheader/**/Typedefstructiphdr{Unsignedinth_len:4oftheheader;//lengt
6、hUnsignedintversion:4;//VersionofIPUnsignedcharTOS;//TypeofserviceUnsignedshorttotal_lenlengthofthepacket;//totalUnsignedshortident;//uniqueidentifierUnsignedshortfrag_and_flags;//flagsUnsignedcharttl;Unsignedcharproto;//protocol(TCPUDPetc)Unsignedshortchecksum;//IPch
7、ecksumUnsignedintsourcelP;UnsignedintdestIP;}IpHeader;ICMP//headerTypedefstructicmphdr{BYTEi_type;BYTEicodetypesubcode;/**/USHORTi_cksum;USIIORTi_id;USHORTi_seq;ThisisnottheSTD/headerbutwereservespacefortime・ULONGtimestamp;}IcmpHeader;^defineSTATUS_FAILEDOxFFFF^define
8、DEF_PACKET_SIZE32Thenumberof^defineDEF_PACKET_NUMBER4/**/senddatagrams^defineIAX_PACKET1024#definexmalloc(s)HeapAlloc(GetPr
此文档下载收益归作者所有