Beispiel #1
1
        static void appServer_NewRequestReceived(AppSession session, SuperSocket.SocketBase.Protocol.StringRequestInfo requestInfo)
        {
            Console.WriteLine(requestInfo.Body);
            Console.WriteLine(requestInfo.Key);
            Console.WriteLine(requestInfo.Parameters);

        }
 void _Error(object o, SuperSocket.ClientEngine.ErrorEventArgs args)
 {
     MainWindow.inst().Dispatcher.Invoke(delegate() {
         session_.Log.Add(new LogMessage {
             MsgType = MessageType.Error,
             Message = args.Exception.Message
         });
     });
 }
 private void OnSocketError(object sender, SuperSocket.ClientEngine.ErrorEventArgs errorEventArgs)
 {
     OnError(JObject.FromObject(new { type = "socket-error", error = errorEventArgs.Exception }), ErrorLevel.Severe);
 }
Beispiel #4
0
        private void websocketClient_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
        {
            Console.WriteLine(e.Exception.GetType() + ": " + e.Exception.Message + Environment.NewLine + e.Exception.StackTrace);

            if (e.Exception.InnerException != null)
            {
                Console.WriteLine(e.Exception.InnerException.GetType());
            }

            return;
        }
Beispiel #5
0
 private void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs eea)
 {
     Console.WriteLine("WebSocket error: " + eea.Exception.Message);
     if (eea.Exception.Message.Contains("connection was forcibly closed"))           //laaaaame
     {
         _webSocket.Close();
         _webSocket.Open();
         Thread.Sleep(1000);
         Subscribe();
     }
 }
Beispiel #6
0
        protected override void OnSessionClosed(SuperWebSocket.WebSocketSession session,SuperSocket.SocketBase.CloseReason value)
        {
            var response = new WebSocketResponse();
            response.RemoteHandler = string.Format(@"appendMsg('{0}')","用户退出!");
            string json = new JavaScriptSerializer().Serialize(response);

            foreach (var s in Sessions)
            {
                s.Send(json);
            }
        }
        void socket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
        {
            //System.Windows.Forms.MessageBox.Show("socket_Error");
            LogService.Log(e.Exception.Message);

            mConnected = false;

            if (mSocket.State != WebSocket4Net.WebSocketState.Open)
            {
                //Keep trying
                mSocket.Open();
            }
            else
            {
                LogService.Log("Network service is lost");
                System.Windows.Forms.MessageBox.Show("Network service is lost");
            }
        }
Beispiel #8
0
 void Client_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
 }
Beispiel #9
0
 public void WebSocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     //MessageBox.Show(e.Exception.Message);
                 
 }
Beispiel #10
0
        public void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
        {
            websocketStatus = "closed";

            Thread.Sleep(5000);
            if (websocketStatus != "opened")
            {
                websocket.Open();
            }
            notifyIcon.ShowBalloonTip(5000, "IT Support", e.Exception.Message, ToolTipIcon.Error);
        }
Beispiel #11
0
        public void HandleMessage(RReadyCode message)
        {
            if (isOrder)//发起方
            {
                if (!message.isReady)
                {
                    ShowMsg("发起远程听诊失败(请确认对方已连接听诊器)");
                    Invoke(new MethodInvoker(() =>
                    {
                        btnPresss.Enabled = false;
                    }));
                }
                else
                {
                    ShowMsg("对方设备就绪,可以发起听诊了");

                    //ShowMsg("远程听诊进行中");
                    Invoke(new MethodInvoker(() =>
                    {
                        btnPresss.Enabled = true;
                    }));
                }
            }
            else
            {
                if (isConnect())
                {
                    Thread thread = new Thread(() =>
                    {
                        //Thread.Sleep(200);
                        SuperSocket.Send(new RStartAudioCode());
                        Current.StartAudioInput();
                        timer.Start();
                        Invoke(new MethodInvoker(() =>
                        {
                            gifBox1.StartAnimate();
                            //processBarEx1.Visible = true;
                        }));
                        //Thread.Sleep(200);
                        while (!isStop)
                        {
                            byte[] packet = new byte[128];
                            int bytesRead = Current.AudioInputStream.Read(packet, 0, packet.Length);
                            if (bytesRead <= 0)
                            {
                                Thread.Sleep(100);
                                continue;
                            }
                            var code = new RTransAudioCode();
                            memoryStream.Write(packet, 0, bytesRead);
                            code.Bytes = packet.Take(bytesRead).ToArray();
                            SuperSocket.Send(code);
                            Thread.Sleep(1);
                        }
                        Current.StopAudioInput();
                    });
                    thread.Start();
                }
                else
                {
                    SuperSocket.Send(new RReadyCode()
                    {
                        isReady = false
                    });
                }
            }
        }
Beispiel #12
0
 static void socketServer_SessionClosed(WebSocketSession session, SuperSocket.SocketBase.CloseReason value)
 {
     Warn(session.SessionID + " closed " + value);
 }
Beispiel #13
0
 private static void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     Console.WriteLine("websocket_Error:" + e.Exception.Message);
 }
Beispiel #14
0
 private void Connection_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
 }
Beispiel #15
0
 void tmp_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     //throw new NotImplementedException();
 }
Beispiel #16
0
 static void a_SessionClosed(SuperWebSocket.WebSocketSession session, SuperSocket.SocketBase.CloseReason value)
 {
     Console.WriteLine("Session closed: " + session.SessionID);
 }
        void _socket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
        {
            Console.WriteLine("Error: " + e.Exception.Message);

            Console.WriteLine(this._socket.State);

            Thread.Sleep(3000);

            if (this._socket.State == WebSocketState.Connecting)
            {
                //this._socket.Close();
                this.isConnected = false;
            }

            if (!this.isConnected)
            {

                Console.WriteLine("Reconnecting...");

                this._isWait = 1;
                this.Connect(this._url);
            }
            //_socket.Close();
            //throw new NotImplementedException();
        }
Beispiel #18
0
        static void ws_SessionClosed(WebSocketSession session, SuperSocket.SocketBase.CloseReason reason)
        {
            User userObj = Server.FindClientBySessionId(session.SessionID);

            foreach (IUserConnection userConnection in userObj.Connections) {
                if (userConnection.Type == UserConnectionTypes.WebSocket) {
                    WebSocketUserCommunication connection = (WebSocketUserCommunication)userConnection;

                    if (connection.SessionId() == session.SessionID) {
                        userConnection.Close();

                        List<IUserConnection> userConnectionList = new List<IUserConnection>();

                        userConnectionList.AddRange(userObj.Connections);
                        userConnectionList.Remove(userConnection);
                        userObj.Connections = new ReadOnlyCollection<IUserConnection>(userConnectionList);
                        //userObj.Connections.Remove(userConnection);
                        break;
                    }
                }
            }

            if (userObj.Connections.Count <= 0) {
                Server.ClientList.Remove(userObj);
                //TODO: just do quit command instead.
                userObj.Save();
            }

                //TODO: deal with multi user login?
        }
        private void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
        {
            Pusher.Trace.TraceEvent(TraceEventType.Error, 0, "Error: " + e.Exception);

            // TODO: What happens here? Do I need to re-connect, or do I just log the issue?
        }
 private void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     Console.WriteLine("error: " + e.Exception);
 }
Beispiel #21
0
 void OnSessionClosed(WebSocketSession session,SuperSocket.SocketBase.CloseReason reason)
 {
     var pair=sessions.FirstOrDefault(p=>p.Value==session);
     if(pair.Key!=null){
         sessions.Remove(pair.Key);
         if(UserRemoved!=null) UserRemoved(new UserEventArgs(pair.Key));
     }
 }
 void ws_SessionClosed(WebSocketSession session, SuperSocket.SocketBase.CloseReason value)
 {
     Console.WriteLine("{0:HH:MM:ss}  与客户端:{1}的会话被关闭 原因:{2}", DateTime.Now, GetSessionName(session), value);
     var msg = string.Format("{0:HH:MM:ss} {1} 离开聊天室", DateTime.Now, GetSessionName(session));
     SendToAll(session, msg);
 }
Beispiel #23
0
 void websocketclient_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     logger.Debug("WebSocket Native Client Error");
 }
Beispiel #24
0
 void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     Debug.WriteLine(e);
 }
 private void OnError(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     Error(this, new ErrorEventArgs(e.Exception));
 }
Beispiel #26
0
 void _socketInstance_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     _dispatcher.LogError("--------------WebSocket Error-------------");
     _dispatcher.LogException(e.Exception);
     _dispatcher.LogError("-----------WebSocket Error End------------");
 }
Beispiel #27
0
        private void Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
        {
            Debug.Print("Battlelog Error:{0}", e.Exception.Message);
            if (m_Error == null)
                return;

            m_Error(this, e);
        }
 void socket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     Console.WriteLine(e.Exception.Message);
 }
 void ws_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     this.OnError("websocket error", e.Exception);
 }
Beispiel #30
0
		private void wsClient_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
		{
			this.OnErrorEvent(sender, new ErrorEventArgs("SocketClient error", e.Exception));
		}
 private void OnWsError(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
 {
     if (null != m_AsyncActionQueue) {
         if (null != e) {
             m_AsyncActionQueue.QueueActionWithDelegation((MyAction<Exception>)this.OnError, e.Exception);
         }
     }
 }