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

資源簡介

包括服務器端和客戶端源碼,采用C#實現服務器與客戶端通過TCP協議進行數據通信,對于多個連接的客戶端,服務器端采用多線程處理客戶端發送的數據。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Net.Sockets;
using?System.Net;
using?System.Threading;

namespace?Client
{
????public?partial?class?Form1?:?Form
????{
????????private?IPAddress?serverIP?=?IPAddress.Parse(“127.0.0.1“);//以本機作測試
????????public?Socket?sock;
????????private?IPEndPoint?serverFullAddr;//完整終端地址
????????public?Form1()
????????{
????????????InitializeComponent();
????????????System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls?=?false;?
????????}

????????

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{

????????}

????????public?void?ReceiveData()
????????{

????????????while?(true)
????????????{
????????????????string?mess?=?““;
????????????????try
????????????????{

????????????????????byte[]?message?=?new?byte[1024];
????????????????????int?bytes?=?0;
????????????????????try
????????????????????{
????????????????????????bytes?=?sock.Receive(message);//接收數據
????????????????????????mess?=?mess?+?Encoding.Default.GetString(message?0?bytes);
????????????????????????if?(message.Length?>?1024)
????????????????????????{
????????????????????????????do
????????????????????????????{
????????????????????????????????bytes?=?sock.Receive(message?message.Length?0);
????????????????????????????????mess?=?mess?+?Encoding.ASCII.GetString(message?0?bytes);
????????????????????????????}
????????????????????????????while?(bytes?>?0);
????????????????????????}
????????????????????????MessageBox.Show(mess);
????????????????????}
????????????????????catch
????????????????????{
????????????????????????//?MessageBox.Show(“空數據!“);
????????????????????}
????????????????????

????????????????}
????????????????catch?(Exception?ex)
????????????????{
????????????????????
????????????????}
????????????}


????????}//調用該函數將socket接收的字符使用RSA私鑰解密后以string形式賦值給全局變量dedata,注意多線程調用


????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????serverIP?=?IPAddress.Parse(textBox1.Text.ToString());
????????????????serverFullAddr?=?new?IPEndPoint(serverIP?int.Parse(textBox2.Text.ToString()));//設置IP,端口
????????????????sock?=?new?Socket(AddressFamily.InterNetwork?SocketType.Stream?ProtocolType.Tcp);
????????????????//指定本地主機地址和端口號
????????????????sock.Connect(serverFullAddr);
????????????????StatuLabel.Text?=?“連接服務器成功!“;
????????????????Thread?thr?=?new?Thread(ReceiveData);
????????????????thr.IsBackground?=?true;
????????????????thr.Start();
????????????}
????????????catch?(Exception)
????????????{
????????????????StatuLabel.Text?=?“連接服務器失敗!“;
????????????}
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????sock.Send(Encoding.Default.GetBytes(textBox3.Text.ToString()));
????????}

?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-05-12?12:43??coresource\
?????目錄???????????0??2018-05-12?12:44??coresource\Client\
?????目錄???????????0??2018-05-12?12:44??coresource\Client\Client\
?????文件???????11776??2018-05-12?12:43??coresource\Client\Client.exe
?????文件?????????987??2018-05-11?14:36??coresource\Client\Client.sln
?????文件???????45568??2018-05-12?12:43??coresource\Client\Client.v12.suo
?????文件?????????189??2018-05-11?14:36??coresource\Client\Client\App.config
?????文件????????3865??2018-05-11?14:52??coresource\Client\Client\Client.csproj
?????文件????????3462??2018-05-12?12:43??coresource\Client\Client\Form1.cs
?????文件????????7332??2018-05-12?12:43??coresource\Client\Client\Form1.Designer.cs
?????文件????????5817??2018-05-12?12:43??coresource\Client\Client\Form1.resx
?????文件?????????518??2018-05-11?14:36??coresource\Client\Client\Program.cs
?????目錄???????????0??2018-05-12?12:43??coresource\Client\Client\Properties\
?????文件????????1336??2018-05-11?14:36??coresource\Client\Client\Properties\AssemblyInfo.cs
?????文件????????2864??2018-05-11?14:36??coresource\Client\Client\Properties\Resources.Designer.cs
?????文件????????5612??2018-05-11?14:36??coresource\Client\Client\Properties\Resources.resx
?????文件????????1093??2018-05-11?14:36??coresource\Client\Client\Properties\Settings.Designer.cs
?????文件?????????249??2018-05-11?14:36??coresource\Client\Client\Properties\Settings.settings
?????目錄???????????0??2018-05-12?12:43??coresource\Server\
?????目錄???????????0??2018-05-12?12:44??coresource\Server\Server\
?????文件???????14336??2018-05-12?12:43??coresource\Server\Server.exe
?????文件?????????987??2018-05-11?13:38??coresource\Server\Server.sln
?????文件???????38400??2018-05-12?12:43??coresource\Server\Server.v12.suo
?????文件?????????189??2018-05-11?13:38??coresource\Server\Server\App.config
?????文件????????9853??2018-05-12?12:43??coresource\Server\Server\Form1.cs
?????文件????????6528??2018-05-12?12:36??coresource\Server\Server\Form1.Designer.cs
?????文件????????6011??2018-05-12?12:36??coresource\Server\Server\Form1.resx
?????文件?????????518??2018-05-11?13:38??coresource\Server\Server\Program.cs
?????目錄???????????0??2018-05-12?12:43??coresource\Server\Server\Properties\
?????文件????????1336??2018-05-11?13:38??coresource\Server\Server\Properties\AssemblyInfo.cs
?????文件????????2864??2018-05-11?13:38??coresource\Server\Server\Properties\Resources.Designer.cs
............此處省略4個文件信息

評論

共有 條評論