91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.16MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-09-08
  • 語言: C#
  • 標(biāo)簽: C#??ASP.NET??SQLDBA??源碼??

資源簡(jiǎn)介

C#UDP通信+文件傳輸 源碼 京華志&精華志出品 希望大家互相學(xué)習(xí),互相進(jìn)步 支持CSDN 支持微軟 主要包括C# ASP.NET SQLDBA 源碼 畢業(yè)設(shè)計(jì) 開題報(bào)告 答辯PPT等

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Net.Sockets;
using?System.Threading;
using?System.IO;

namespace?BroadcastExample
{
????public?class?ConnectionClient
????{
????????Socket?sokMsg;
????????DGShowMsg?dgShowMsg;//負(fù)責(zé)?向主窗體文本框顯示消息的方法委托
????????DGShowMsg?dgRemoveConnection;//?負(fù)責(zé)?從主窗體?中移除?當(dāng)前連接
????????Thread?threadMsg;

???????

????????#region?構(gòu)造函數(shù)
????????///?
????????///?
????????///?

????????///?通信套接字
????????///?向主窗體文本框顯示消息的方法委托
????????public?ConnectionClient(Socket?sokMsg?DGShowMsg?dgShowMsg?DGShowMsg?dgRemoveConnection)
????????{
????????????this.sokMsg?=?sokMsg;
????????????this.dgShowMsg?=?dgShowMsg;
????????????this.dgRemoveConnection?=?dgRemoveConnection;

????????????this.threadMsg?=?new?Thread(RecMsg);
????????????this.threadMsg.IsBackground?=?true;
????????????this.threadMsg.Start();
????????}
????????#endregion

????????bool?isRec?=?true;
????????#region?02負(fù)責(zé)監(jiān)聽客戶端發(fā)送來的消息
????????void?RecMsg()
????????{
????????????while?(isRec)
????????????{
????????????????try
????????????????{
????????????????????byte[]?arrMsg?=?new?byte[1024?*?1024?*?2];
????????????????????//接收?對(duì)應(yīng)?客戶端發(fā)來的消息
????????????????????int?length?=?sokMsg.Receive(arrMsg);
????????????????????//將接收到的消息數(shù)組里真實(shí)消息轉(zhuǎn)成字符串
????????????????????string?strMsg?=?System.Text.Encoding.UTF8.GetString(arrMsg?0?length);
????????????????????//通過委托?顯示消息到?窗體的文本框
????????????????????dgShowMsg(strMsg);
????????????????}
????????????????catch?(Exception?ex)
????????????????{
????????????????????isRec?=?false;
????????????????????//從主窗體中?移除?下拉框中對(duì)應(yīng)的客戶端選擇項(xiàng),同時(shí)?移除?集合中對(duì)應(yīng)的?ConnectionClient對(duì)象
????????????????????dgRemoveConnection(sokMsg.RemoteEndPoint.ToString());
????????????????}
????????????}
????????}
????????#endregion

????????#region?03向客戶端發(fā)送消息
????????///?
????????///?向客戶端發(fā)送消息
????????///?

????????///?
????????public?void?Send(string?strMsg)
????????{
????????????byte[]?arrMsg?=?System.Text.Encoding.UTF8.GetBytes(strMsg);
????????????byte[]?arrMsgFinal?=?new?byte[arrMsg.Length?+?1];

????????????arrMsgFinal[0]?=?0;//設(shè)置?數(shù)據(jù)標(biāo)識(shí)位等于0,代表?發(fā)送的是?文字
????????????arrMsg.CopyTo(arrMsgFinal?1);

????????????sokMsg.Send(arrMsgFinal);
????????}
????????#endregion

????????#region?04向客戶端發(fā)送文件數(shù)據(jù)?+void?SendFile(string?strPath)
????????///?
????????///?04向客戶端發(fā)送文件數(shù)據(jù)
????????///?

????????///?文件路徑
????????public?void?SendFile(string?strPath)
????????{
????????????//通過文件流?讀取文件內(nèi)容
????????????using?(FileStream?fs?=?new?FileStream(strPath?FileMode.OpenOrCreate))
????????????{
????????????????byte[]?arrFile?=?new?byte[1024?*?1024?*?2];
????????????????//讀取文件內(nèi)容到字節(jié)數(shù)組,并?獲得?實(shí)際文件大小
????????????????int?length?=?fs.Read(arrFile?0?arrFile.Length);
????????????????//定義一個(gè)?新數(shù)組,長度為文件實(shí)際長度?+1
????????????????byte[]?arrFileFina

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

?????文件??????59136??2012-06-25?01:07??C#UDP通信+文件傳輸\2000多商業(yè)程序?OA?程序下載?版權(quán)說明.txt

?????文件??????59136??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\2000多商業(yè)程序?OA?程序下載?版權(quán)說明.txt

?????文件??????17920??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\bin\Debug\BroadcastExample.exe

?????文件??????42496??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\bin\Debug\BroadcastExample.pdb

?????文件??????14328??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\bin\Debug\BroadcastExample.vshost.exe

?????文件????????490??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\bin\Debug\BroadcastExample.vshost.exe.manifest

?????文件???????3534??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\BroadcastExample.csproj

?????文件???????4623??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\ConnectionClient.cs

?????文件????????161??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\DGShowMsg.cs

?????文件??????18495??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Form1.cs

?????文件???????6662??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Form1.Designer.cs

?????文件???????5814??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Form1.resx

?????文件???????1502??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\BroadcastExample.csproj.FileListAbsolute.txt

?????文件???????2254??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\BroadcastExample.csproj.FileListAbsolute.txt

?????文件????????847??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\BroadcastExample.csproj.GenerateResource.Cache

?????文件??????17920??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\BroadcastExample.exe

?????文件????????180??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\BroadcastExample.Form1.resources

?????文件??????42496??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\BroadcastExample.pdb

?????文件????????180??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\BroadcastExample.Properties.Resources.resources

?????文件???????4608??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

?????文件????????491??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Program.cs

?????文件???????1204??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Properties\AssemblyInfo.cs

?????文件???????2856??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Properties\Resources.Designer.cs

?????文件???????5612??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Properties\Resources.resx

?????文件???????1114??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Properties\Settings.Designer.cs

?????文件????????249??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample\Properties\Settings.settings

?????文件????????938??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample.sln

????..A..H.?????18944??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\BroadcastExample.suo

?????文件????3543552??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\DevComponents.DotNetBar2.dll

?????文件???????1189??2012-06-25?01:07??C#UDP通信+文件傳輸\BroadcastExample\UpgradeLog.xml

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

評(píng)論

共有 條評(píng)論