




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、實驗報告實驗名稱 :計算機(jī)網(wǎng)絡(luò)課程設(shè)計學(xué)生姓名 : xxxxxxxxxxxxxxx專業(yè): xxxxxxxxxxxxxxx班級: xxxxxxxxxxxxxxx學(xué)號: xxxxxxxxxxxxxxx指導(dǎo)教師 :xxxxxxxxxxxxxxx實驗成績 :實驗地點(diǎn) :實驗時間 :2016 年 5月6 日一、實驗?zāi)康呐c實驗要求1、實驗?zāi)康膶旧铣橄蟮母拍钆c具體實現(xiàn)技術(shù)結(jié)合,通過網(wǎng)絡(luò)軟件編程的實踐,深入理解理論課上學(xué)習(xí)到的ARP、IP、TCP 等重要網(wǎng)絡(luò)協(xié)議的原理,通過自己動手編程封裝與發(fā)送這些數(shù)據(jù)包, 加深對網(wǎng)絡(luò)協(xié)議的理解, 掌握協(xié)議幀的結(jié)構(gòu)和工作原理及其對協(xié)議棧的貢獻(xiàn)。2、實驗要求網(wǎng)絡(luò)課程設(shè)計包含
2、兩個部分的內(nèi)容:題目一是數(shù)據(jù)包的封裝發(fā)送和解析(ARP/IP/TCP),要求使用 Winpcap 技術(shù)和 Socket 技術(shù),根據(jù) ARP/IP/TCP 幀的結(jié)構(gòu),封裝數(shù)據(jù)包發(fā)送到局域網(wǎng)中。另外要捕獲網(wǎng)絡(luò)中的 TCP/IP/ARP 數(shù)據(jù)包,解析數(shù)據(jù)包的內(nèi)容,并將結(jié)果顯示,并同時寫入日志文件。題目二是從可選題目中選擇一個,可選題目均是網(wǎng)絡(luò)應(yīng)用小程序,要求小組使用網(wǎng)絡(luò)編程技術(shù)設(shè)計并實現(xiàn)一個網(wǎng)絡(luò)應(yīng)用程序, 加深對網(wǎng)絡(luò)協(xié)議協(xié)的理解, 并鍛煉網(wǎng)絡(luò)編程能力。二、實驗設(shè)備(環(huán)境)及要求1、實驗硬件設(shè)備:計算機(jī)型號:聯(lián)想ThinkPad T430u處理器型號: Intel i5 主頻: 1.8Hz網(wǎng)卡型號:
3、(1)Realtek PCIe GBE (2)Broadcom 802.11n2、實驗軟件要求:操作系統(tǒng): Windows10應(yīng)用軟件: Visual Studio 2015 Pro3、小組成員及分工:三、實驗內(nèi)容與步驟1、實驗 1:數(shù)據(jù)包的封裝發(fā)送和解析(ARP/IP/TCP)(1)實驗內(nèi)容1) 程序目標(biāo):根據(jù) IP 幀的結(jié)構(gòu),封裝 IP 數(shù)據(jù)包發(fā)送到局域網(wǎng)中。 并捕獲網(wǎng)絡(luò)中的IP 數(shù)據(jù)包,解析數(shù)據(jù)包的內(nèi)容,并將結(jié)果顯示,并同時寫入日志文件。2) 程序功能:以命令行形式運(yùn)行在標(biāo)準(zhǔn)輸出中顯示捕獲的 IP 報文的首部字段的內(nèi)容。使用 winpcap 訪問網(wǎng)卡,手動封裝定義 IP 首部的數(shù)據(jù)結(jié)構(gòu)填
4、充數(shù)據(jù)包,發(fā)送數(shù)據(jù)包,捕獲數(shù)據(jù)包使用 winpcap,捕獲 IP 數(shù)據(jù)包(2)主要步驟1) 總體設(shè)計:a. 獲取設(shè)備列表并打印,打開所選擇的適配器;b. 準(zhǔn)備工作:定義 ip 相關(guān)的結(jié)構(gòu)體、打開要存放結(jié)果的文件,設(shè)置過濾器,手寫 ip 數(shù)據(jù)報(內(nèi)容有無效的 MAC 源和目的地址, 和均為本機(jī)地址的 ip 源地址和目的地址,即發(fā)給自己一個 ip 報文),設(shè)置抓到數(shù)據(jù)報的解析和輸出到文件的操作函數(shù)(解析 ip 報,打印并寫入文件:報文的版本、協(xié)議、源和目的地址等)。c. 發(fā)包、抓包。d. 分析獲取的數(shù)據(jù)。獲取設(shè)備列表打開選擇適配器過濾數(shù)據(jù)包解析數(shù)據(jù)包2) 具體實現(xiàn):#define HAVE_REM
5、OTE#include "pcap.h"#include "remote-ext.h"#include "stdio.h"#include "stdlib.h"/*4 字節(jié)的 IP 地址 */typedef struct ip_addressu_char byte1;u_char byte2;u_char byte3;u_char byte4;ip_address;/*IPv4 首部 */typedef struct ip_headeru_char ver_ihl;/版本(4bits) +首部長度(4bits)u_
6、char tos;/服務(wù)類型u_short tlen;/ 總長類型u_short identification;/ 標(biāo)識u_short flags_fo;/標(biāo)志位+段偏移量u_char ttl;/ 存活時間u_char proto;/協(xié)議u_short crc;/首部校驗和ip_address daddr;/目的地址ip_address saddr;/源地址u_int op_pad;/ 選項與填充ip_header;void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_dat
7、a);/* packet handler函數(shù)原型*/void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);int main()pcap_if_t *alldevs;pcap_if_t *d;int inum;int i=0;pcap_t *adhandle;char errbufPCAP_ERRBUF_SIZE;u_int netmask;char packet_filter = "ip"/ 抓包類型pcap_dumper_t *dumpfil
8、e;/* 獲取本機(jī)設(shè)備列表*/if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) = -1)fprintf(stderr,"Error in pcap_findalldevs: %sn", errbuf);exit(1);/* 打印適配器列表*/for(d=alldevs; d; d=d->next)printf("%d. %s", +i, d->name);if (d->description)printf(" (%s)n"
9、, d->description);elseprintf(" (No description available)n");if(i=0)printf("nNo interfaces found! Make sure WinPcap is installed.n"); return -1;printf("Enter the interface number (1-%d):",i);scanf("%d", &inum);if(inum < 1 | inum > i)printf("n
10、Interface number out of range.n");/* 釋放設(shè)備列表*/pcap_freealldevs(alldevs);return -1;/* 跳轉(zhuǎn)到選中的適配器*/for(d=alldevs, i=0; i< inum-1 ;d=d->next, i+);/* 打開設(shè)備*/if ( (adhandle= pcap_open(d->name,/ 設(shè)備名65536,/ 65535 保證能捕獲到不同數(shù)據(jù)鏈路層上每個數(shù)據(jù)包的全部內(nèi)容PCAP_OPENFLAG_PROMISCUOUS,/ 混雜模式1000,/ 讀取超時時間NULL,/ 遠(yuǎn)程機(jī)器驗證e
11、rrbuf) ) = NULL)/ 錯誤緩沖池fprintf(stderr,"nUnableto open the adapter. %s is not supported by WinPcapn",d->name);/* 釋放設(shè)備列表*/pcap_freealldevs(alldevs);return -1;/* 打開堆文件 */dumpfile = pcap_dump_open(adhandle, "D:save.txt");if(dumpfile=NULL)fprintf(stderr,"nError opening output
12、filen");return -1;/* 檢查數(shù)據(jù)鏈路層,只考慮以太網(wǎng)*/if(pcap_datalink(adhandle)!=DLT_EN10MB)fprintf(stderr, "nThis program works only on Ethernet networds.n");/* 釋放設(shè)備列表*/pcap_freealldevs(alldevs);return -1;if(d->addresses != NULL)/獲得接口第一個地址的掩碼netmask = (struct sockaddr_in *)(d->addresses->ne
13、tmask)->sin_addr.S_un.S_addr;else/如果接口沒有地址,那么我們假設(shè)一個C 類的掩碼netmask=0xffffff;/編譯過濾器if(pcap_compile(adhandle,&fcode,packet_filter,1,netmask)<0)fprintf(stderr,"nUnable to compile the packet filter. Check the syntax.n");/釋放設(shè)備列表pcap_freealldevs(alldevs);return -1;/設(shè)置過濾器if(pcap_setfilter
14、(adhandle,&fcode)<0)fprintf(stderr,"nError setting the filter.n");/釋放設(shè)備列表pcap_freealldevs(alldevs);return -1;printf("nlistening on %s.n", d->description);/釋放設(shè)備列表pcap_freealldevs(alldevs);/* 手寫數(shù)據(jù)包 */u_char packet100;/* 假設(shè)在以太網(wǎng)上,設(shè)置MAC 的目的地址為1:1:1:1:1:1*/packet0=1;packet1=1
15、;packet2=1;packet3=1;packet4=1;packet5=1;/* 設(shè)置 MAC 的源地址為2:2:2:2:2:2*/packet6=2;packet7=2;packet8=2;packet9=2;packet10=2;packet11=2;/* 設(shè)置 ip 類型 */packet12=0x08;packet13=0x00;packet14=0x45;packet15=0x20;packet16=0x00;packet17=0x28;packet18=0xcb;packet19=0x16;packet20=0x00;packet21=0x00;packet22=0x2e;p
16、acket23=0x06;packet24=0x3e;packet25=0xe6;packet26=0xc0;/192packet27=0xa8;/168packet28=0x01;/1packet29=0x64;/100packet30=0xc0;packet31=0xa8;packet32=0x01;packet33=0x64;packet34=0x8f;packet35=0x50;/* 填充剩下的內(nèi)容*/for(i=36;i<100;i+)packeti=i%256;/* 發(fā)送數(shù)據(jù)包 */if (pcap_sendpacket(adhandle, packet, 100 /* si
17、ze */) != 0)fprintf(stderr,"nError sending the packet: n", pcap_geterr(adhandle);return 0;elseprintf("Send successed");/* 開始捕獲*/pcap_loop(adhandle, 0, packet_handler,(unsigned char *)dumpfile);/回調(diào)方式捕獲數(shù)據(jù)包pcap_close(adhandle);return 0;/*每次捕獲到數(shù)據(jù)包時,libpcap 都會自動調(diào)用這個回調(diào)函數(shù)*/void packet_h
18、andler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)struct tm *ltime;char timestr16;ip_header *ih;u_int ip_len;time_t local_tv_sec;/保存數(shù)據(jù)包到文件中pcap_dump(u_char*)param, header, pkt_data);/* 將時間戳轉(zhuǎn)換成可識別的格式*/local_tv_sec = header->ts.tv_sec;ltime=localtime(&local_tv_sec);
19、strftime( timestr, sizeof timestr, "%H:%M:%S", ltime);/打印數(shù)據(jù)包的時間戳和長度printf("%s,%.6d len:%dn", timestr, header->ts.tv_usec, header->len);/獲得 IP 數(shù)據(jù)包頭部的位置ih = (ip_header*)(pkt_data+14);/ 以太網(wǎng)頭部長度/* 打印IP 地址和UDP 端口*/printf(" 版本 +首部長度 :%u",ih->ver_ihl);printf(" 協(xié)議
20、 :%u",ih->proto);printf("首部校驗和:%u",ih->crc);printf("目的地址:%u.%u.%u.%u",ih->daddr.byte1,ih->daddr.byte2,ih->daddr.byte3,ih->daddr.byte4);printf(" 源 地 址 ih->saddr.byte1,ih->saddr.byte2,ih->saddr.byte3,ih->saddr.byte4);:%u.%u.%u.%un",FILE
21、*fp;fp=fopen("D:jiexi.txt", "a+");fprintf(fp," 解析結(jié)果: ");fprintf(fp," 版本 +首部長度 :%u",ih->ver_ihl);fprintf(fp," 協(xié)議 :%u",ih->proto);fprintf(fp," 首部校驗和 :%u",ih->crc);fprintf(fp,"目的地址:%u.%u.%u.%u",ih->daddr.byte1,ih->dadd
22、r.byte2,ih->daddr.byte3,ih->daddr.byte4);fprintf(fp,"源地址:%u.%u.%u.%un",ih->saddr.byte1,ih->saddr.byte2,ih->saddr.byte3,ih->saddr.byte4);fclose(fp);2、實驗 2:子網(wǎng)內(nèi)文件傳送(1)實驗內(nèi)容(明確的實驗內(nèi)容)設(shè)計并實現(xiàn)一個局域網(wǎng)內(nèi)部的文件傳送工具,使用 TCP 協(xié)議進(jìn)行可靠文件傳輸。以圖形界面運(yùn)行,不同結(jié)點(diǎn)上文件自動同步(2)主要步驟(詳細(xì)的實驗步驟(系統(tǒng)/方法 /算法等),圖文結(jié)合)1) 問題
23、定義:實現(xiàn)一個局域網(wǎng)內(nèi)的文件傳送與聊天的軟件2) 需求分析:局域網(wǎng)內(nèi)的文件傳送應(yīng)當(dāng)具備以下功能:在線用戶的及時發(fā)現(xiàn)和更新選擇一對一或者一對多對話模式與選擇用戶進(jìn)行聊天和文件傳輸用戶下線通知與更新用戶列表3) 系統(tǒng)設(shè)計:參考飛鴿傳書的實現(xiàn)原理,總結(jié)設(shè)計方案如下:架構(gòu)設(shè)計:本系統(tǒng)采用本地應(yīng)用程序設(shè)計,僅適用于在同一局域網(wǎng)的主機(jī)通信;互相發(fā)現(xiàn):本系統(tǒng)運(yùn)行時啟動局域網(wǎng)廣播線程,發(fā)出包含主機(jī)名稱、主機(jī) IP 以及新加入標(biāo)識符的廣播表明自己新加入;用戶列表:監(jiān)聽到其他用戶的廣播信息后更新列表,顯示當(dāng)前在線的用戶名和用戶 IP;更新列表:在系統(tǒng)退出時會廣播本機(jī)信息,標(biāo)識表明自己離開,其余在線用戶接收到信息后
24、更新提示該用戶下線;選擇用戶:可以單獨(dú)選擇或者多項選擇用戶列表中的用戶;發(fā)送消息:選擇用戶后,在輸入框中輸入聊天信息,點(diǎn)擊“發(fā)送”按鈕系統(tǒng)會發(fā)送 UDP 數(shù)據(jù)包給對應(yīng)用戶的ip 地址,端口是 8011;接受消息:系統(tǒng)實時監(jiān)聽 8011 端口以接受不同用戶發(fā)來的消息并展示在聊天窗口中;發(fā)送文件:選擇指定用戶,點(diǎn)擊“發(fā)送文件”按鈕,選擇本機(jī)相應(yīng)文件后,與目標(biāo)用戶建立TCP 連接,發(fā)送字節(jié)流。端口為8011;接受文件:監(jiān)聽到有TCP 連接請求時建立實時連接,系統(tǒng)提示用戶是否接收文件,選擇接收后選擇相應(yīng)路徑與文件名后進(jìn)行接收,接收成功后再聊天窗口顯示提示信息。4) 詳細(xì)設(shè)計: 局域網(wǎng)用戶列表的建立:軟
25、件啟動后定時的使用 UDP 協(xié)議向55這個廣播地址發(fā)送廣播包 ,端口設(shè)置為 8001。廣播包內(nèi)容包含主機(jī)名、 IP、標(biāo)識符等信息,已啟動軟件的用戶通過 8001 端口收到此廣播包后,就會在自己的用戶列表中添加這個用戶的用戶名、 IP 地址等信息,從而局域網(wǎng)內(nèi)的本系統(tǒng)用戶都能建立起用戶列表; 傳送與接收信息:傳送聊天信息時同樣使用 UDP 協(xié)議,用戶填寫消息后點(diǎn)擊按鈕調(diào)用發(fā)送消息的函數(shù), 然后通過 8011 端口發(fā)送 UDP 包。系統(tǒng)在啟動時通過開辟新線程來監(jiān)聽 8011 端口,時刻監(jiān)聽發(fā)送到本機(jī)的信息。 發(fā)送文件:用戶發(fā)送文件時建立一個帶參數(shù)的線程來發(fā)送文件,調(diào)用相應(yīng)
26、的 TCP 發(fā)送函數(shù)來發(fā)送文件,使用的是 8001 端口,由于協(xié)議不同因此與之前的廣播并不沖突; 接收文件:軟件啟動時開啟一個線程用來接收文件,此線程在正常工作條件下處于阻塞監(jiān)聽狀態(tài),直到收到建立 TCP 連接的請求,之后提示用戶收到文件選擇是否接受,之后選擇保存路徑,進(jìn)行接收。 用戶離開:用戶離線時發(fā)送一個離線廣播包到 55 的 8001 端口,包中含有 LEAVE 的標(biāo)識符,收到此廣播包的用戶, 根據(jù)包中的 IP 地址刪除用戶列表中相應(yīng)的用戶信息,并在聊天窗口顯示“ XXX 用戶已經(jīng)離開”; 聊天記錄保存:考慮到用戶有保存聊天記錄的需求,在聊天記錄右側(cè)點(diǎn)擊“保存”
27、按鈕,可以將當(dāng)前聊天記錄保存為 txt 文件到用戶指定目錄中?;螯c(diǎn)擊“清空”,清空當(dāng)前用戶聊天記錄。5) 具體實現(xiàn):( C#)using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Linq;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;using S
28、ystem.Threading.Tasks;using System.Windows.Forms;namespace IPMessagepublic partial class frmMain : Form/用戶實體public class Userprivate string localname;/ 用戶名public string localNameget return localname; set localname = value; private string localip;/ 用戶 IPpublic string localIPget return localip; set lo
29、calip = value; /用戶數(shù)組聲明public static List<User> Userslist = new List<User>();/獲得本機(jī)名和本機(jī)IPpublic User getInfo()User u = new User();string localName = Dns.GetHostName();/ 獲取主機(jī)名/Console.WriteLine(" 主機(jī)名: 0", localName);u.localName = localName;IPHostEntry localHost = Dns.GetHostEntry(
30、localName);/ 輸出對應(yīng)的 IP 地址IPAddress localIP = null;for (int i = 0; i < localHost.AddressList.Length; i+)if (localHost.AddressListi.AddressFamily = AddressFamily.InterNetwork)localIP = localHost.AddressListi;break;u.localIP = localIP.ToString();return u;/發(fā)送廣播消息public void broadMessage()Socketsocket=
31、newSocket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);IPEndPoint iep = new IPEndPoint(IPAddress.Parse("55"), 8001);/ 設(shè)置 Broadcast 值為表示允許套接字發(fā)送廣播消息,該值默認(rèn)為不允許socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast,1);User u = getInfo();/ 標(biāo)識符為
32、NEWstring send = "NEW"+","+u.localName + "," + u.localIP;byte sendM = System.Text.Encoding.Unicode.GetBytes(send);/byte sendIP = System.Text.Encoding.Unicode.GetBytes(u.localIP);while (isBroad)socket.SendTo(sendM, iep);Thread.Sleep(200);/socket.SendTo(sendIP, iep);socke
33、t.Close();public void remove(User u)Userslist.Remove(u);this.rbChatContent.AppendText(" 用戶: " + u.localName + " 離開 " + "n"); this.lbUser.Items.Remove(u.localName + "|" + u.localIP); ;/接收廣播消息public void reciveBroad()Socket socket = newSocket(AddressFamily.Inter
34、Network,SocketType.Dgram,ProtocolType.Udp);IPEndPoint iep = new IPEndPoint(IPAddress.Any, 8001);socket.Bind(iep);EndPoint ep = (EndPoint)iep;/System.Timers.Timer t = new System.Timers.Timer(1000); /t.Elapsed += new System.Timers.ElapsedEventHandler(theout); while (true)Byte getBytes = new byte1024;s
35、ocket.ReceiveFrom(getBytes, ref ep);string getData = System.Text.Encoding.Unicode.GetString(getBytes);getData = getData.TrimEnd('u0000');string sArray = getData.Split(',');/this.rbChatContent.AppendText(" 新上線用戶: " + sArray1 + "n"); if (sArray.Length > 1)bool ex
36、ist = false;if (Userslist!=null)foreach (User us in Userslist)if (us.localIP = sArray2)exist = true;break;if (exist = false && sArray0="NEW")User u = new User();u.localName = sArray1;u.localIP = sArray2;if (u != null) Userslist.Add(u);this.rbChatContent.AppendText(" 新上線用戶:&quo
37、t;+u.localName+"n");this.lbUser.Items.Add(u.localName + "|" + u.localIP);Thread.Sleep(100);else if(sArray0 = "LEAVE")User u = new User();u.localName = sArray1;u.localIP = sArray2;if (u != null)Userslist.Remove(u);this.rbChatContent.AppendText(" 用戶: " + u.local
38、Name + " 離開"+"n");this.lbUser.Items.Remove(u.localName + "|" + u.localIP);Thread.Sleep(200);/ <summary>/ 通過 TcpClient 滿足多用戶發(fā)送文件/ </summary>/ <param name="ip"></param>public void tcpSend(List<string> ips)FileStream fs = new FileStr
39、eam(filePath, FileMode.Open);foreach(string ip in ips)TcpClient client = new TcpClient();client.Connect(ip, 8001);NetworkStream ns = client.GetStream();int size = 0;long len = 0;while (len < fs.Length)byte buffer = new byte1024;size = fs.Read(buffer, 0, buffer.Length);ns.Write(buffer, 0, size);le
40、n += size;fs.Flush();ns.Flush();fs.Close();ns.Close();/ <summary>/ 使用 TcpClient 接收文件/ </summary>public void RecevieFile()TcpListener listener = new TcpListener(IPAddress.Any, 8001);listener.Start();while(true)tryint size = 0;int len = 0;TcpClient client = listener.AcceptTcpClient();if (c
41、lient.Connected)this.rbChatContent.AppendText(" 連接成功 ");NetworkStream stream = client.GetStream();if (stream != null)DialogResult rs;rs = MessageBox.Show(" 你收到一個文件",MessageBoxButtons.YesNo);if (rs = DialogResult.Yes), 是否接收?"," 提示SaveFileDialog sfd = new SaveFileDialog()
42、;if(sfd.ShowDialog(this)=System.Windows.Forms.DialogResult.OK)string fileSavePath = sfd.FileName;/ 獲得用戶保存文件的路徑FileStreamfs=newFileStream(fileSavePath,FileMode.Create, FileAccess.Write);byte buffer = new byte1024;while (size = stream.Read(buffer, 0, buffer.Length) > 0)fs.Write(buffer, 0, size);len
43、 += size;fs.Flush();stream.Flush();stream.Close();client.Close();this.rbChatContent.AppendText("文 件 接 受 成 功 "+fileSavePath + "n");catch(Exception ex)MessageBox.Show(ex.ToString();/ <summary>/ 主函數(shù)/ </summary> public frmMain()InitializeComponent();Thread seThread = new
44、Thread(this.broadMessage); seThread.Start();Thread reThread = new Thread(this.reciveBroad);reThread.Start();Thread rfThread = new Thread(this.RecevieFile);rfThread.Start();Thread rmThread = new Thread(this.listenMsg);rmThread.Start();/離開發(fā)送廣播private void frmMain_FormClosing(object sender, FormClosing
45、EventArgs e)isBroad = false;this.broadMessage();Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);IPEndPoint iep = new IPEndPoint(IPAddress.Parse("55"), 8001);/ 設(shè)置 Broadcast 值為表示允許套接字發(fā)送廣播消息,該值默認(rèn)為不允許socket.SetSocketOption(SocketOptionLev
46、el.Socket, SocketOptionName.Broadcast,1);User u = getInfo();/ 標(biāo)識符為LEAVEstring send = "LEAVE" + "," + u.localName + "," + u.localIP;byte sendM = System.Text.Encoding.Unicode.GetBytes(send);/byte sendIP = System.Text.Encoding.Unicode.GetBytes(u.localIP);socket.SendTo(send
47、M, iep);/socket.SendTo(sendIP, iep);socket.Close();System.Environment.Exit(0);/文件路徑public string filePath=null;private void btnSendFile_Click(object sender, EventArgs e)if (this.lbUser.SelectedItem=null)MessageBox.Show(" 請選擇用戶 ");elseOpenFileDialog file1 = new OpenFileDialog();if (file1.Sh
48、owDialog() = DialogResult.OK)List<string> ips = new List<string>();foreach (object obj in this.lbUser.SelectedItems)string getData = null;getData = obj.ToString();string arrays = null;arrays = getData.Split('|');filePath = file1.FileName;if (arrays1!=null)ips.Add(arrays1);this.rbChatContent.AppendText(" 發(fā)送文件: " + filePath + "n");/帶參數(shù)的線程建立ThreadStart sta
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 云南省2025年高三3月份模擬考試化學(xué)試題含解析
- 陜西省西安市一中年2025屆高考仿真卷化學(xué)試卷含解析
- 太空旅游資源
- 河北省卓恒教育集團(tuán)2024-2025學(xué)年高二下學(xué)期3月聯(lián)考生物學(xué)試題(含答案)
- 2025屆天津南大附中高一3月月考-英語試卷
- 2025屆湖南省衡陽市重點(diǎn)中學(xué)高考全國統(tǒng)考預(yù)測密卷化學(xué)試卷含解析
- 家庭網(wǎng)絡(luò)安全教育手冊
- 中考數(shù)學(xué)高頻考點(diǎn)專項練習(xí):專題15 圓綜合訓(xùn)練 (3)及答案
- 成品收發(fā)工作總結(jié)
- 2025年煤制乙二醇合作協(xié)議書
- 全國第三屆職業(yè)技能大賽(無人機(jī)駕駛(植保)項目)選拔賽理論考試題庫(含答案)
- 危險化學(xué)品目錄(2024版)
- 建筑注漿加固法規(guī)范
- JHA工作危險性分析(全)
- 雙臺110kV主變短路電流計算書
- 載荷試驗方案
- 壓力容器設(shè)計審核人員答辯考試標(biāo)準(zhǔn)要點(diǎn)歸納及特殊材料特殊工況的設(shè)計注意事項
- 小學(xué)四年級下冊美術(shù)課件-5.14成群的動物-嶺南版(25張)ppt課件
- 北京市土地一級開發(fā)項目管理工作流程圖
- 安全工器具及設(shè)施發(fā)放登記臺賬(共3頁)
- 小學(xué)生安全教育研究課題結(jié)題報告
評論
0/150
提交評論