C# 高效Socket运行机制系列文章一 SocketAsyncEventArgs
2013-03-06 18:08
537 查看
微软创建了SocketAsyncEventArgs类来帮助你编写可扩展、高性能socket服务器代码。
SocketAsyncEventArgs使用网络套接字类System.Net通过异步方法完成I / O端口通讯。在以下的文章中我们会实现一个基于windows TCP/IP协议的可靠的,可扩展的Socket通讯。Microsoft 对相关技术的说明可以参考SocketAsyncEventArgs,
I/O Completion Ports。
SocketAsyncEventArgs帮助我们访问一个套接字,它有异步工作的优点,可以设置缓冲区空间、对象池,同时响应完成事件Completed event。有一个状态对象,可以通过属性访问套接字。
这篇文章的目的是帮助你理解的基本使用SocketAsyncEventArgs类。
对于SocketAsyncEventArgs类,微软的网站说,它需要“平台:Windows 7,Windows Vista、Windows XP SP3、Windows Server 2008、Windows Server 2003。NET Framework Client Profile框架支持:4、3.5
SP1,3.0 SP1,2.0 SP1。()。NET Framework Client Profile框架客户概要支持:4、3.5 SP1。”
Properties
Methods
Events
下一扁文章我会针对TCP协议进行进一步的说明
SocketAsyncEventArgs使用网络套接字类System.Net通过异步方法完成I / O端口通讯。在以下的文章中我们会实现一个基于windows TCP/IP协议的可靠的,可扩展的Socket通讯。Microsoft 对相关技术的说明可以参考SocketAsyncEventArgs,
I/O Completion Ports。
SocketAsyncEventArgs帮助我们访问一个套接字,它有异步工作的优点,可以设置缓冲区空间、对象池,同时响应完成事件Completed event。有一个状态对象,可以通过属性访问套接字。
这篇文章的目的是帮助你理解的基本使用SocketAsyncEventArgs类。
对于SocketAsyncEventArgs类,微软的网站说,它需要“平台:Windows 7,Windows Vista、Windows XP SP3、Windows Server 2008、Windows Server 2003。NET Framework Client Profile框架支持:4、3.5
SP1,3.0 SP1,2.0 SP1。()。NET Framework Client Profile框架客户概要支持:4、3.5 SP1。”
Properties
Name | Description | |
---|---|---|
![]() | AcceptSocket | Gets or sets the socket to use or the socket created for accepting a connection with an asynchronous socket method. |
![]() | Buffer | Gets the data buffer to use with an asynchronous socket method. |
![]() | BufferList | Gets or sets an array of data buffers to use with an asynchronous socket method. |
![]() | BytesTransferred | Gets the number of bytes transferred in the socket operation. |
![]() | ConnectByNameError | Gets the exception in the case of a connection failure when a DnsEndPoint was used. |
![]() | ConnectSocket | The created and connected Socket object after successful completion of the ConnectAsync method. |
![]() | Count | Gets the maximum amount of data, in bytes, to send or receive in an asynchronous operation. |
![]() | DisconnectReuseSocket | Gets or sets a value that specifies if socket can be reused after a disconnect operation. |
![]() | LastOperation | Gets the type of socket operation most recently performed with this context object. |
![]() | Offset | Gets the offset, in bytes, into the data buffer referenced by the Buffer property. |
![]() | ReceiveMessageFromPacketInfo | Gets the IP address and interface of a received packet. |
![]() | RemoteEndPoint | Gets or sets the remote IP endpoint for an asynchronous operation. |
![]() | SendPacketsElements | Gets or sets an array of buffers to be sent for an asynchronous operation used by the Socket.SendPacketsAsync method. |
![]() | SendPacketsFlags | Gets or sets a bitwise combination of TransmitFileOptions values for an asynchronous operation used by the Socket.SendPacketsAsync method. |
![]() | SendPacketsSendSize | Gets or sets the size, in bytes, of the data block used in the send operation. |
![]() | SocketClientAccessPolicyProtocol | Obsolete. Gets or sets the protocol to use to download the socket client access policy file. |
![]() | SocketError | Gets or sets the result of the asynchronous socket operation. |
![]() | SocketFlags | Gets the results of an asynchronous socket operation or sets the behavior of an asynchronous operation. |
![]() | UserToken | Gets or sets a user or application object associated with this asynchronous socket operation. |
Name | Description | |
---|---|---|
![]() | Dispose | Releases the unmanaged resources used by the SocketAsyncEventArgs instance and optionally disposes of the managed resources. |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Frees resources used by the SocketAsyncEventArgs class. (Overrides Object.Finalize().) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnCompleted | Represents a method that is called when an asynchronous operation completes. |
![]() | SetBuffer(Int32, Int32) | Sets the data buffer to use with an asynchronous socket method. |
![]() | SetBuffer(Byte[], Int32, Int32) | Sets the data buffer to use with an asynchronous socket method. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
![]() | Completed | The event used to complete an asynchronous operation. |
相关文章推荐
- C#SocketAsyncEventArgs实现高效能多并发TCPSocket通信 (服务器实现)
- C#SocketAsyncEventArgs实现高效能多并发TCPSocket通信 (客户端实现)
- C#SocketAsyncEventArgs实现高效能多并发TCPSocket通信 (服务器实现)
- C# 使用 SocketAsyncEventArgs 实现UdpSocket系列
- C#SocketAsyncEventArgs实现高效能多并发TCPSocket通信 (服务器实现)
- (转)C#SocketAsyncEventArgs实现高效能多并发TCPSocket通信
- C#SocketAsyncEventArgs实现高效能多并发TCPSocket通信 (客户端实现)
- C#网络编程系列文章(五)之Socket实现异步UDP服务器
- C#网络编程系列文章(一)之Socket实现异步TCP服务器
- C#网络编程系列文章(二)之Socket实现同步TCP服务器
- C#网络编程系列文章(六)之Socket实现同步UDP服务器
- C#高性能Socket服务器SocketAsyncEventArgs的实现(IOCP)
- c# socket 框架学习 SocketAsyncEventArgsPool 封装
- C# SocketAsyncEventArgs High Performance Socket Code
- Use .NET SocketAsyncEventArgs to write socket server code in C#
- C# SocketAsyncEventArgs Server
- C#网络编程系列文章(一)之Socket实现异步TCP服务器
- C#温故而知新学习系列之.NET运行机制—1-.NET Framework概述及其组成
- C#高性能大容量SOCKET并发(十):SocketAsyncEventArgs线程模型
- C#网络编程系列文章(五)之Socket实现异步UDPserver