• 大小: 1.02M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: Socket  实例  

资源简介

简单实现Socket消息收发,包含客户端和服务端

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Threading;
namespace ScoketServer
{
   public class ConnectionClient
    {
        Socket sokMsg;//客户端Socket对象
        Action dgShowMsg;//负责 向主窗体文本框显示消息的方法委托
        Action dgRemoveConnection;// 负责 从主窗体 中移除 当前连接
        Thread threadMsg;
        public ConnectionClient(Socket sokMsg Action dgShowMsg Action dgRemoveConnection)
        {
            this.sokMsg = sokMsg;
            this.dgShowMsg = dgShowMsg;
            this.dgRemoveConnection = dgRemoveConnection;

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

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-09-26 14:45  SocketDemo\
     目录           0  2017-10-13 17:43  SocketDemo\ScoketServer\
     文件        2593  2015-09-15 11:44  SocketDemo\ScoketServer\ConnectionClient.cs
     文件        9569  2017-09-25 18:30  SocketDemo\ScoketServer\Form1.Designer.cs
     文件        7916  2017-10-13 17:43  SocketDemo\ScoketServer\Form1.cs
     文件        5817  2017-09-25 18:30  SocketDemo\ScoketServer\Form1.resx
     文件         493  2015-09-15 11:35  SocketDemo\ScoketServer\Program.cs
     目录           0  2017-08-09 10:26  SocketDemo\ScoketServer\Properties\
     文件        1344  2015-09-15 11:35  SocketDemo\ScoketServer\Properties\AssemblyInfo.cs
     文件        2876  2015-09-15 11:35  SocketDemo\ScoketServer\Properties\Resources.Designer.cs
     文件        5612  2015-09-15 11:35  SocketDemo\ScoketServer\Properties\Resources.resx
     文件        1099  2015-09-15 11:35  SocketDemo\ScoketServer\Properties\Settings.Designer.cs
     文件         249  2015-09-15 11:35  SocketDemo\ScoketServer\Properties\Settings.settings
     文件        3784  2015-09-15 11:39  SocketDemo\ScoketServer\ScoketServer.csproj
     目录           0  2017-08-09 10:26  SocketDemo\ScoketServer\bin\
     目录           0  2017-09-26 14:42  SocketDemo\ScoketServer\bin\Debug\
     文件       14848  2017-10-13 17:44  SocketDemo\ScoketServer\bin\Debug\ScoketServer.exe
     文件       34304  2017-10-13 17:44  SocketDemo\ScoketServer\bin\Debug\ScoketServer.pdb
     文件       24216  2017-09-26 14:51  SocketDemo\ScoketServer\bin\Debug\ScoketServer.vshost.exe
     文件         490  2017-03-19 05:00  SocketDemo\ScoketServer\bin\Debug\ScoketServer.vshost.exe.manifest
     目录           0  2017-08-09 10:26  SocketDemo\ScoketServer\obj\
     目录           0  2017-10-13 17:44  SocketDemo\ScoketServer\obj\Debug\
     文件        1453  2017-09-28 21:41  SocketDemo\ScoketServer\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6827  2017-09-16 23:18  SocketDemo\ScoketServer\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         180  2017-09-26 14:42  SocketDemo\ScoketServer\obj\Debug\ScoketServer.Form1.resources
     文件         180  2017-09-26 14:42  SocketDemo\ScoketServer\obj\Debug\ScoketServer.Properties.Resources.resources
     文件        1801  2017-09-26 23:39  SocketDemo\ScoketServer\obj\Debug\ScoketServer.csproj.FileListAbsolute.txt
     文件         977  2017-09-26 14:42  SocketDemo\ScoketServer\obj\Debug\ScoketServer.csproj.GenerateResource.Cache
     文件        2211  2017-09-26 23:39  SocketDemo\ScoketServer\obj\Debug\ScoketServer.csprojResolveAssemblyReference.cache
     文件       14848  2017-10-13 17:44  SocketDemo\ScoketServer\obj\Debug\ScoketServer.exe
     文件       34304  2017-10-13 17:44  SocketDemo\ScoketServer\obj\Debug\ScoketServer.pdb
............此处省略128个文件信息

评论

共有 条评论