資源描述:
《tcp和udp數(shù)據(jù)包發(fā)送與接收》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、實(shí)驗(yàn)6TCP和UDP數(shù)據(jù)包發(fā)送與接收一、實(shí)驗(yàn)?zāi)康腡CP協(xié)議是TCP/IP協(xié)議族的核心協(xié)議之一。熟悉TCP包結(jié)構(gòu)對(duì)于理解網(wǎng)絡(luò)層次結(jié)構(gòu),以及TCP協(xié)議與IP協(xié)議的關(guān)系有著重要意義。根據(jù)TCP協(xié)議的基本原理,通過(guò)封裝與發(fā)送一個(gè)標(biāo)準(zhǔn)的TCP數(shù)據(jù)包,了解TCP包結(jié)構(gòu)中各字段的含義與用途,從而深入理解傳輸層與下面各層的關(guān)系。二、實(shí)驗(yàn)要求(1)掌握TCP/UDP報(bào)頭結(jié)構(gòu)、各字段含義以及校驗(yàn)和計(jì)算方法;(2)使用Wincap(Lipcap)構(gòu)造并發(fā)送TCP,UDP數(shù)據(jù)包;(3)使用原始套接字(RawSocket)發(fā)送自定義的TCP,UDP數(shù)據(jù)包;(4)使用NDIS協(xié)
2、議驅(qū)動(dòng)發(fā)送自定義的TCP/UDP數(shù)據(jù)包。三、實(shí)驗(yàn)內(nèi)容實(shí)驗(yàn)一SOCKET編程實(shí)驗(yàn)實(shí)驗(yàn)內(nèi)容1、通過(guò)調(diào)試、運(yùn)行“UDPClient”和“UDPServer”實(shí)驗(yàn)程序,加強(qiáng)對(duì)網(wǎng)絡(luò)通訊原理的了解。(或“簡(jiǎn)單Client”和“簡(jiǎn)單Server”實(shí)驗(yàn)程序,下同)2、學(xué)習(xí)分析實(shí)驗(yàn)程序功能結(jié)構(gòu),了解基于SOCKET編程的網(wǎng)絡(luò)通信軟件的基本設(shè)計(jì)方法。3、在所提供的”UDPClient”和“UDPServer”實(shí)驗(yàn)程序基礎(chǔ)上,完善程序功能。4、通過(guò)實(shí)驗(yàn)學(xué)習(xí)和了解SOKCET通信的實(shí)現(xiàn)方法。實(shí)驗(yàn)結(jié)果分析與總結(jié)(1)總結(jié)運(yùn)行”UDPClient”和“UDPServer”實(shí)驗(yàn)程
3、序的運(yùn)行情況。UDPClient運(yùn)行結(jié)otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeenthe
4、NorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,MinistersandUDPServer運(yùn)行結(jié)果(2)設(shè)計(jì)交互程序的運(yùn)行結(jié)果如下:otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi
5、,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,Direc
6、torofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand(3)總結(jié)程序設(shè)計(jì)的情況,列出所設(shè)計(jì)或修改部分的源代碼清單。附上程序源代碼。Client端修改的代碼如下://(3)開(kāi)始接收或發(fā)送過(guò)程printf("-------------waitingformessagefromSeaver-------------");//進(jìn)入一個(gè)循環(huán)while(1){//輸入并發(fā)送信息給服務(wù)器buffer[0]='