using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace MECF.Framework.RT.Core.IoProviders.Siemens.Net.StateOne
{
///
/// 网络中的异步对象
///
internal class StateObject : StateOneBase
{
#region Constructor
///
/// 实例化一个对象
///
public StateObject( )
{
}
///
/// 实例化一个对象,指定接收或是发送的数据长度
///
/// 数据长度
public StateObject( int length )
{
DataLength = length;
Buffer = new byte[length];
}
#endregion
#region Public Member
///
/// 唯一的一串信息
///
public string UniqueId { get; set; }
///
/// 网络套接字
///
public Socket WorkSocket { get; set; }
///
/// 是否关闭了通道
///
public bool IsClose { get; set; }
#endregion
#region Public Method
///
/// 清空旧的数据
///
public void Clear( )
{
IsError = false;
IsClose = false;
AlreadyDealLength = 0;
Buffer = null;
}
#endregion
}
#if !NET35
///
/// 携带TaskCompletionSource属性的异步对象
///
/// 类型
internal class StateObjectAsync : StateObject
{
#region Constructor
///
/// 实例化一个对象
///
public StateObjectAsync( ) : base( )
{
}
///
/// 实例化一个对象,指定接收或是发送的数据长度
///
/// 数据长度
public StateObjectAsync( int length ) : base( length )
{
}
#endregion
public System.Threading.Tasks.TaskCompletionSource Tcs { get; set; }
}
#endif
}