xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 11.16MB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2023-07-29
  • 語言: Java
  • 標(biāo)簽:

資源簡介

廣東工業(yè)大學(xué)網(wǎng)絡(luò)課程設(shè)計(jì)ping程序設(shè)計(jì)和實(shí)現(xiàn) 1.已知參數(shù):目的節(jié)點(diǎn)IP地址或主機(jī)名 2.設(shè)計(jì)要求:通過原始套接字編程,實(shí)現(xiàn)Ping的基本功能 2.1初始化Windows Sockets網(wǎng)絡(luò)環(huán)境; 2.2解析命令行參數(shù),構(gòu)造目的端socket地址; 2.3定義IP、ICMP報(bào)文; 2.4接收ICMP差錯(cuò)報(bào)文并進(jìn)行解析。 3. Java環(huán)境為MyEclipse, C++環(huán)境為Visual C++ 文件包含源代碼,報(bào)告,可執(zhí)行文件,直接更改名字就可以上交

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#pragma?comment(lib?“ws2_32.lib“)
#define?ICMP_ECHOREPLY?0?//ICMP回應(yīng)答復(fù)
#define?ICMP_ECHOREQ?8?//ICMP回應(yīng)請求
#define?REQ_DATASIZE?32?//請求數(shù)據(jù)報(bào)大小

//定義IP首部格式
typedef?struct?_IPHeader
{
u_char?VIHL;?//版本和首部長度
u_char?ToS;?//服務(wù)類型
u_short?TotalLen;?//總長度
u_short?ID;?//標(biāo)識(shí)號
u_short?Frag_Flags;?//片偏移量
u_char?TTL;?//生存時(shí)間
u_char?Protocol;?//協(xié)議
u_short?Checksum;?//首部校驗(yàn)和
struct?in_addr?SrcIP;?//源IP地址
struct?in_addr?DestIP;?//目的地址
}IPHDR?*PIPHDR;


//定義ICMP首部格式
typedef?struct?_ICMPHeader
{
u_char?Type;?//類型
u_char?Code;?//代碼
u_short?Checksum;?//首部校驗(yàn)和
u_short?ID;?//標(biāo)識(shí)
u_short?Seq;?//序列號
char?Data;?//數(shù)據(jù)
}ICMPHDR?*PICMPHDR;


//定義ICMP回應(yīng)請求
typedef?struct?_ECHOREQUEST
{
ICMPHDR?icmpHdr;
DWORD?dwTime;
char?cData[REQ_DATASIZE];
}ECHOREQUEST?*PECHOREQUEST;


//定義ICMP回應(yīng)答復(fù)
typedef?struct?_ECHOREPLY
{
IPHDR?ipHdr;
ECHOREQUEST?echoRequest;
char?cFiller[256];
}ECHOREPLY?*PECHOREPLY;

//計(jì)算校驗(yàn)和
u_short?checksum(u_short?*buffer?int?len)
{
register?int?nleft?=?len;
register?u_short?*w?=?buffer;
register?u_short?answer;
register?int?sum?=?0;
//使用32位累加器進(jìn)行16位的反饋計(jì)算
while?(?nleft?>?1?)
{
sum?+=?*w++;
nleft?-=?2;
}
//補(bǔ)全奇數(shù)位
if?(?nleft?==?1?)
{
u_short?u?=?0;
*(u_char?*)(&u)?=?*(u_char*)w;
sum?+=?u;
}
//將反饋的16位從高位移到低位
sum?=?(sum?>>?16)?+?(sum?&?0xffff);
sum?+=?(sum?>>?16);
answer?=?~sum;
return?(answer);
}

//發(fā)送回應(yīng)請求函數(shù)
int?SendEchoRequest(SOCKET?s?struct?sockaddr_in?*lpstToAddr)
{
static?ECHOREQUEST?echoReq;
static??int?nId?=?1;
static?int?nSeq?=?1;
int?nRet;
//填充回應(yīng)請求消息
echoReq.icmpHdr.Type?=?ICMP_ECHOREQ;
echoReq.icmpHdr.Code?=?0;
echoReq.icmpHdr.Checksum?=?0;
echoReq.icmpHdr.ID?=?nId++;
echoReq.icmpHdr.Seq?=?nSeq++;
//填充要發(fā)送的數(shù)據(jù)
for?(nRet?=?0;?nRet?{
echoReq.cData[nRet]?=?‘1‘?+?nRet;
}
//存儲(chǔ)發(fā)送的時(shí)間
echoReq.dwTime?=?GetTickCount();
//計(jì)算回應(yīng)請求的校驗(yàn)和
echoReq.icmpHdr.Checksum?=?checksum((u_short*)&echoReq?sizeof(ECHOREQUEST));
//發(fā)送回應(yīng)請求
nRet?=?sendto(s(LPSTR)&echoReqsizeof(ECHOREQUEST)
??0(struct?sockaddr*)lpstToAddrsizeof(SOCKADDR_IN));
if?(nRet?==?SOCKET_ERROR)
{
printf(“send?to()?error:%d\n“?WSAGetLastError());
}
return?(nRet);
}

//接收應(yīng)答回復(fù)并進(jìn)行解析
DWORD?RecvEchoReply(SOCKET?s?LPSOCKADDR_IN?lpsaFrom?u_char?*pTTL)
{
ECHOREPLY?echoReply;
int?nRet;
int?nAddrLen?=?sizeof(struct?sockaddr_in);
//接收應(yīng)答回復(fù)
nRet?=?recvfrom(s(LPSTR)&echoReplysizeof(ECHOREPLY)
0(LPSOCKADDR)lpsaFrom&nAddrLen);
//檢驗(yàn)接收結(jié)果

if?(nRet?==?SOCKET_ERROR)
{
printf(“recvfrom()?error:%d\n“WSAGetLastError());
}
//記錄返回的TTL
*pTTL?=?echoReply.ipHdr.TTL;
//返回應(yīng)答時(shí)間
return(echoReply.echoRequest.dwTime);
}

//等待回應(yīng)答復(fù)使用select模型
int?WaitForEchoReply(SOCKET?s)
{
struct?timeval?timeout;
fd_set?readfds;
readfds.fd_count?=?1;
readfds.fd_array[0]?=?s;
timeout.tv_sec?=?1;
timeout.tv_usec?=?0;
return(select(1?&readfds?NULL?NULL?&timeout));
}

//PING功能實(shí)現(xiàn)
void?Ping(char?*pstrHost)
{
SOCKET?rawSocket;
LP

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????????891??2011-12-27?21:51??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest.sln

????..A..H.?????11264??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest.suo

?????文件??????30720??2011-12-28?21:56??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\可執(zhí)行程序.exe

?????文件???????5860??2011-12-28?21:56??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\源代碼.cpp

?????文件???23875584??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest.sdf

?????文件???32768000??2011-12-28?21:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\ipch\pingtest-976f476e\pingtest-d2d0b45a.ipch

?????文件?????335240??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\Debug\pingtest.ilk

?????文件?????445440??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\Debug\pingtest.pdb

?????文件??????30720??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\Debug\pingtest.exe

?????文件???????3226??2011-12-27?21:52??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\pingtest.vcxproj

?????文件????????143??2011-12-27?21:51??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\pingtest.vcxproj.user

?????文件????????946??2011-12-27?21:52??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\pingtest.vcxproj.filters

?????文件???????5860??2011-12-28?21:56??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\pingtest.cpp

?????文件????????937??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\pingtest.log

?????文件???????1385??2011-12-28?21:56??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\pingtest.Build.CppClean.log

?????文件?????????96??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\pingtest.lastbuildstate

?????文件?????617472??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\vc100.idb

?????文件?????118784??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\vc100.pdb

?????文件??????24644??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\CL.read.1.tlog

?????文件????????972??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\CL.write.1.tlog

?????文件???????1330??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\cl.command.1.tlog

?????文件????????381??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\pingtest.exe.intermediate.manifest

?????文件???????4764??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\link.read.1.tlog

?????文件???????1656??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\link.write.1.tlog

?????文件???????2750??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\link.command.1.tlog

?????文件???????1514??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\mt.read.1.tlog

?????文件????????726??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\mt.write.1.tlog

?????文件???????1082??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\mt.command.1.tlog

?????文件??????38327??2012-01-04?17:49??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\pingtest\Debug\pingtest.obj

?????文件?????533504??2012-04-09?22:11??李志鵬網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告3109005985pingtest\計(jì)算機(jī)網(wǎng)絡(luò)課程設(shè)計(jì)報(bào)告.doc

............此處省略9個(gè)文件信息

評論

共有 條評論

相關(guān)資源