文件名称:CSHARPSOCKET
介绍说明--下载内容均来自于网络,请自行研究使用
C#实现多线程网络通讯
整个系统由三个核心线程组成,并由.NET线程池统一管理:
侦听客户端连接请求线程:ListenClientRequest(),循环侦听客户端连接请求。如果有,检测该客户端IP,看是否是同一观测设备,然后建立一个客户端TSession对象,并通过Socket异步调用方法BeginReceive()接收数据包、EndReceive()处理数据包
数据包处理线程:HandleDatagrams(),循环检测数据包队列_datagramQueue,完成数据包解析、判断类型、存储等工作
客户端状态检测线程:CheckClientState(),循环检查客户端会话-C# multi-threaded network communication system is composed of three core thread throughout the composition, by the. NET thread pool unified management: a client connection request listening thread: ListenClientRequest (), loop listening client connection request. If you have, testing the client IP, to see if the same observation equipment, and then create a client-side TSession object, and through Socket asynchronous call methods BeginReceive () to receive data packets, EndReceive () processing of data packet data packet processing threads: HandleDatagrams ( ), cyclic test data packet queue _datagramQueue, the completion of the packet parsing to determine the type, storage, etc. the client state detection thread: CheckClientState (), loop checks the client session
整个系统由三个核心线程组成,并由.NET线程池统一管理:
侦听客户端连接请求线程:ListenClientRequest(),循环侦听客户端连接请求。如果有,检测该客户端IP,看是否是同一观测设备,然后建立一个客户端TSession对象,并通过Socket异步调用方法BeginReceive()接收数据包、EndReceive()处理数据包
数据包处理线程:HandleDatagrams(),循环检测数据包队列_datagramQueue,完成数据包解析、判断类型、存储等工作
客户端状态检测线程:CheckClientState(),循环检查客户端会话-C# multi-threaded network communication system is composed of three core thread throughout the composition, by the. NET thread pool unified management: a client connection request listening thread: ListenClientRequest (), loop listening client connection request. If you have, testing the client IP, to see if the same observation equipment, and then create a client-side TSession object, and through Socket asynchronous call methods BeginReceive () to receive data packets, EndReceive () processing of data packet data packet processing threads: HandleDatagrams ( ), cyclic test data packet queue _datagramQueue, the completion of the packet parsing to determine the type, storage, etc. the client state detection thread: CheckClientState (), loop checks the client session
(系统自动生成,下载前可以参看下载内容)
下载文件列表
CSHARPSOCKET.doc