public DelayTest(DelayOptions options, DelayMetrics metrics) : base(options, metrics)
 {
 }
示例#2
0
    /// <summary>
    /// Starts up the network test by firing up
    /// the listenerThread and tying it to
    /// the TestNetworkListen() function.
    /// </summary>
    public void StartTest()
    {
        #region start test
        // test the network
        networkTest_FrameCount = 0;
        networkTest_DelayMetrics = new DelayMetrics();
        networkTest_largestMessage = 0;

        ResetNetworkConnection();

        try
        {
          socket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP );
          socket.Connect( SERVER_IP, 7070 );
        }
        catch( Exception exc )
        {
          SPW.logger.Log( "Couldn't connect to server!", LogMessageType.Error, OutputDevice.ScreenAndFile );
          SPW.logger.Log( "Exception text: " + exc.Message, LogMessageType.Error, OutputDevice.ScreenAndFile );
          SPW.sw[ "connectFail" ] = new StringItem( "Connection failed.  Is the server up?", Color.Red );
          SPW.gameState = GameState.TitleScreen;
          return;
        }
        listenerThread = new Thread( TestNetworkListen );
        listenerThread.Start();

        SPW.logger.Log( "-- BEGIN TEST --", LogMessageType.Info, OutputDevice.File );

        SPW.gameState = GameState.Testing;
        SPW.netState = NetState.Waiting;

        // clear the old result text, if there
        SPW.sw[ "testResult1" ] = new StringItem();
        SPW.sw[ "testResult2" ] = new StringItem();

        // fire off empty starter message
        Send( new Message() );
        #endregion
    }