/// <summary>
 /// 服务端专用
 /// 服务端不知道连接的标志,将连接标志置为-1
 /// </summary>
 /// <param name="TcpSc"></param>
 /// <param name="TcpEventDisConnected"></param>
 /// <param name="TcpEventReceive"></param>
 /// <param name="TcpEventUpDateUi"></param>
 /// <param name="TcpLimitSleep"></param>
 /// <param name="OnError"></param>
 /// <param name="TcpReceiveBufferSize"></param>
 /// <param name="TcpSendBufferSize"></param>
 /// <param name="TcpSocket"></param>
 internal TcpSocketEventArgs(SynchronizationContext TcpSc, TcpSocketDelgate TcpEventDisConnected,
                             TcpSocketReceiveDelGate TcpEventReceive, SendOrPostCallback TcpEventUpDateUi, LimitSleepDelgate TcpLimitSleep,
                             OnErrorHandle OnError, int TcpReceiveBufferSize, int TcpSendBufferSize, Socket TcpSocket) :
     this(TcpSc, TcpEventDisConnected, TcpEventReceive, TcpEventUpDateUi, TcpLimitSleep, OnError, TcpReceiveBufferSize,
          TcpSendBufferSize, TcpSocket, -1)
 {
 }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="TcpSc">SC同步上下文</param>
        /// <param name="TcpEventDisConnected">当有断开连接时事件的激活方法</param>
        /// <param name="TcpEventReceive">接收数据时事件的激活方法</param>
        /// <param name="TcpEventUpDateUi">更新UI界面事件的激活方法</param>
        /// <param name="TcpRemoveSocket">移除服务端或客户端的方法</param>
        /// <param name="TcpReceiveBufferSize">接收缓冲区的大小</param>
        /// <param name="TcpSendBufferSize">发送缓冲区的大小</param>
        /// <param name="TcpSocket">Socket</param>
        internal TcpSocketEventArgs(SynchronizationContext TcpSc, TcpSocketDelgate TcpEventDisConnected,
                                    TcpSocketReceiveDelGate TcpEventReceive, SendOrPostCallback TcpEventUpDateUi, LimitSleepDelgate TcpLimitSleep,
                                    OnErrorHandle OnError, int TcpReceiveBufferSize, int TcpSendBufferSize, Socket TcpSocket, short sign)
        {
            this.Sign = sign;

            SC             = TcpSc;
            OnDisConnected = TcpEventDisConnected;
            OnReceive      = TcpEventReceive;
            OnUIInvoke     = TcpEventUpDateUi;
            OnLimitSleep   = TcpLimitSleep;
            this.OnError   = OnError;

            Sock = TcpSocket;
            Sock.SendBufferSize    = TcpSendBufferSize;
            Sock.ReceiveBufferSize = TcpReceiveBufferSize;
            ReceiveBuffer          = new byte[Sock.ReceiveBufferSize];
            SendBuffer             = new byte[Sock.SendBufferSize];
            GetRemoteEndPoint      = Sock.RemoteEndPoint;
            GetLocalEndPoint       = Sock.LocalEndPoint;

            int keepAlive = -1744830460;                                                    // SIO_KEEPALIVE_VALS

            byte[] inValue = new byte[] { 1, 0, 0, 0, 0x10, 0x27, 0, 0, 0xe8, 0x03, 0, 0 }; // True, 10秒, 1 秒
            Sock.IOControl(keepAlive, inValue, null);
            //Sock.IOControl(IOControlCode.KeepAliveValues, inValue, null);
            //设置 KeepAlive 为 10 秒,检查间隔为 1 秒。如果拨掉客户端网线
            //服务器的 Socket.Receive() 会在 10 秒后断开连接
        }
 public void OnError(OfflineRegionError offlineRegionError)
 {
     OnErrorHandle?.Invoke(offlineRegionError);
 }
 public void OnError(OfflineRegionError p0)
 {
     OnErrorHandle?.Invoke(p0);
 }