资源简介
该DEMO主要根据官网例子改编,另外加了些个人处理,保留接发数据传播,另外支持数万并发

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace BRKJ.IPCO.Client
{
public class BufferManager
{
int m_numBytes; // the total number of bytes controlled by the buffer pool
byte[] m_buffer; // the underlying byte array maintained by the Buffer Manager
Stack m_freeIndexPool; //
int m_currentIndex;
int m_bufferSize;
public BufferManager(int totalBytes int bufferSize)
{
m_numBytes = totalBytes;
m_currentIndex = 0;
m_bufferSize = bufferSize;
m_freeIndexPool = new Stack();
}
// Allocates buffer space used by the buffer pool
public void InitBuffer()
{
// create one big large buffer and divide that
// out to each SocketAsyncEventArg object
m_buffer = new byte[m_numBytes];
}
// Assigns a buffer from the buffer pool to the
// specified SocketAsyncEventArgs object
//
// true if the buffer was successfully set else false
public bool SetBuffer(SocketAsyncEventArgs args)
{
if (m_freeIndexPool.Count > 0)
{
args.SetBuffer(m_buffer m_freeIndexPool.Pop() m_bufferSize);
}
else
{
if ((m_numBytes - m_bufferSize) < m_currentIndex)
{
return false;
}
args.SetBuffer(m_buffer m_currentIndex m_bufferSize);
m_currentIndex += m_bufferSize;
}
return true;
}
// Removes the buffer from a SocketAsyncEventArg object.
// This frees the buffer back to the buffer pool
public void FreeBuffer(SocketAsyncEventArgs args)
{
m_freeIndexPool.Push(args.Offset);
args.SetBuffer(null 0 0);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 189 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\App.config
文件 9497 2018-07-28 15:33 TCPSOCKET.IPCO\BRKJ.IPCO.Client\bin\ClientDebug.rar
文件 20480 2018-07-28 15:33 TCPSOCKET.IPCO\BRKJ.IPCO.Client\bin\Debug\BRKJ.IPCO.Client.exe
文件 189 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\bin\Debug\BRKJ.IPCO.Client.exe.config
文件 4064 2018-07-28 14:04 TCPSOCKET.IPCO\BRKJ.IPCO.Client\BRKJ.IPCO.Client.csproj
文件 2165 2018-07-28 13:47 TCPSOCKET.IPCO\BRKJ.IPCO.Client\BufferManager.cs
文件 13392 2018-07-28 15:05 TCPSOCKET.IPCO\BRKJ.IPCO.Client\CliectSocket.cs
文件 5750 2018-07-28 13:58 TCPSOCKET.IPCO\BRKJ.IPCO.Client\ClientRequest.cs
文件 5088 2018-07-28 15:32 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Form1.cs
文件 7478 2018-07-28 15:32 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Form1.Designer.cs
文件 5817 2018-07-28 15:32 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Form1.resx
文件 538 2018-07-28 13:47 TCPSOCKET.IPCO\BRKJ.IPCO.Client\MySocketEventArgs.cs
文件 864 2018-07-28 15:07 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\BRKJ.IPCO.Client.csproj.FileListAbsolute.txt
文件 977 2018-07-28 15:33 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\BRKJ.IPCO.Client.csproj.GenerateResource.Cache
文件 20480 2018-07-28 15:33 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\BRKJ.IPCO.Client.exe
文件 180 2018-07-28 15:33 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\BRKJ.IPCO.Client.Form1.resources
文件 46592 2018-07-28 15:33 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\BRKJ.IPCO.Client.pdb
文件 180 2018-07-28 14:14 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\BRKJ.IPCO.Client.Properties.Resources.resources
文件 7109 2018-07-28 13:53 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 528 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Program.cs
文件 1356 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Properties\AssemblyInfo.cs
文件 2884 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Properties\Resources.Designer.cs
文件 5612 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Properties\Resources.resx
文件 1103 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Properties\Settings.Designer.cs
文件 249 2018-07-28 11:42 TCPSOCKET.IPCO\BRKJ.IPCO.Client\Properties\Settings.settings
文件 189 2018-07-28 11:41 TCPSOCKET.IPCO\BRKJ.IPCO.Server\BRKJ.IPCO.Server\App.config
文件 1152 2018-07-28 12:08 TCPSOCKET.IPCO\BRKJ.IPCO.Server\BRKJ.IPCO.Server\AsyncUserToken.cs
............此处省略57个文件信息
- 上一篇:C# DBHelper类
- 下一篇:C#线程间操作无效Study
相关资源
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 020ASP.NET车辆综合管理系统.zip
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
- c# 高校档案信息管理系统
- c#向word文件插入图片
评论
共有 条评论