public void SplashPresenter_StartApplication_Picks_Up_SocketExceptions_When_Starting_WebServer() { var exception = new SocketException(); _WebServer.SetupSet(s => s.Online = true).Callback(() => { throw exception; }); _WebServer.Setup(a => a.Port).Returns(123); _Presenter.Initialise(_View.Object); _Presenter.StartApplication(); _Log.Verify(g => g.WriteLine("Caught exception when starting web server: {0}", exception.ToString()), Times.Once()); _View.Verify(v => v.ReportProblem(String.Format(Strings.CannotStartWebServerFull, 123), Strings.CannotStartWebServerTitle, false), Times.Once()); _View.Verify(v => v.ReportProblem(Strings.SuggestUseDifferentPortFull, Strings.SuggestUseDifferentPortTitle, false), Times.Once()); }
/// <summary> /// Event triggered if a network error occurs while communicating with /// the LoginServer. /// </summary> /// <param name="Exception"></param> private void m_LoginClient_OnNetworkError(SocketException Exc) { MessageBox.Show(Exc.ToString()); Application.Exit(); }
/// <summary> /// Event triggered if a network error occurs while communicating with /// the LoginServer. /// </summary> /// <param name="Exception"></param> private static void m_LoginClient_OnNetworkError(SocketException Exc) { Console.WriteLine(Exc.ToString()); Console.ReadLine(); Environment.Exit(0); }
private void server_ErrorReceived(object sender, NetSockErrorReceivedEventArgs e) { if (e.Exception.GetType() == typeof(System.Net.Sockets.SocketException)) { System.Net.Sockets.SocketException s = (System.Net.Sockets.SocketException)e.Exception; account.Log(new ErrorTextInformation("Error: " + e.Function + " - " + s.SocketErrorCode.ToString() + "\r\n" + s.ToString()), 0); } else { account.Log(new ErrorTextInformation("Error: " + e.Function + "\r\n" + e.Exception.ToString()), 0); } }
private void OnSocketError(object sender, EventNetSockErrorReceived e) { if (e.Exception.GetType() == typeof(System.Net.Sockets.SocketException)) { System.Net.Sockets.SocketException s = (System.Net.Sockets.SocketException)e.Exception; Debug.Log("OnSocketError > System.Net.Sockets Exception " + e.Function + " - " + s.SocketErrorCode.ToString() + " => " + s.ToString()); } else { Debug.Log("OnSocketError > ERROR : " + e.Function.ToString() + " => " + e.Exception.ToString()); } _ReceiveSchedule.AddMessage(eEventIDs.SocketError); }