Ejemplo n.º 1
0
 public SocketAgentClientSession(IPipelineSocket acceptSocket
                                 , SocketAgentConfig _config
                                 , SocketAgent SocketAgentServer
                                 )
 {
     this.SocketAgentServer = SocketAgentServer;
     this._config           = _config;
     this.acceptSocket      = acceptSocket;
     this.remSocket         = new PipelineSocket(1024);
     Initializer();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 从一个已经连接的通讯IPipelineSocket基础上创建一个客户端单向管道实例
        /// </summary>
        public static SocketClient CreateNewSocketSinglePipelineFromSocket(IPipelineSocket socket, int bufferSize)
        {
            if (socket == null || !socket.Connected)
            {
                var ex = new System.Exception("只有是连接成功的IPipelineSocket对象才能进行管道创建");
                //SystemRunErrorPorvider.CatchException(ex);
                throw ex;
            }
            var _pipelineSocket = socket;
            var pip             = new SocketClient();

            pip.Client = _pipelineSocket;
            return(pip);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  初始化一个新的 <see cref="WebSocketSession"/> 实例
        /// </summary>
        /// <param name="acceptSocket">监听器完成连接的基础通讯连接</param>
        /// <param name="webSocketServer">表示当前连接所属的连接服务监听器</param>
        public WebSocketSession(IPipelineSocket acceptSocket, WebSocketServer webSocketServer)
        {
            //初始化当前连接的监听器
            _webSocketServer = webSocketServer;

            //实例化为一个基础的消息解析函数器
            WebsocketHandle = new WebSocket_Handle(this);
            AcceptSocket    = acceptSocket;
            //通知事件的绑定
            AcceptSocket.ReceiveCompleted = AcceptSocket_ReceiveCompleted;
            AcceptSocket.Disposed         = AcceptSocket_Disposed;
            //启动数据接收
            AcceptSocket.StartReceive();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="s"></param>
 public AcceptedEventArgs(IPipelineSocket s)
 {
     this.AcceptSocket = s;
 }