예제 #1
0
        /// <summary>
        /// Runs TCP client mode
        /// </summary>
        public void Run()
        {
            echoReceived = echoCorrupted = 0;

            TcpEchoClient echoClient = new TcpEchoClient(arguments.FirstArgument, remotePort);
            echoClient.RepeatCount = repeatCount;
            echoClient.LocalPort = localPort;
            echoClient.ResponseTimeout = responseTimeout;
            if (! string.IsNullOrEmpty(echoPattern))
                echoClient.EchoPattern = Encoding.ASCII.GetBytes(echoPattern);

            echoClient.OnHostnameResolved += new TcpEchoClient.HostnameResolvedDelegate(echoClient_OnHostnameResolved);
            echoClient.OnEchoResponse += new TcpEchoClient.EchoResponseDelegate(echoClient_OnEchoResponse);
            echoClient.OnSocketException += new TcpEchoClient.SocketExceptionDelegate(echoClient_OnSocketException);
            echoClient.OnFinish += new TcpEchoClient.FinishDelegate(echoClient_OnFinish);
            echoClient.Start();
        }
예제 #2
0
        /// <summary>
        /// Runs TCP client mode
        /// </summary>
        public void Run()
        {
            _echoReceived = _echoCorrupted = 0;

            var echoClient = new TcpEchoClient(_arguments.FirstArgument, _remotePort)
            {
                RepeatCount = _repeatCount,
                LocalPort = _localPort,
                ResponseTimeout = _responseTimeout
            };

            if (! string.IsNullOrEmpty(_echoPattern))
                echoClient.EchoPattern = Encoding.ASCII.GetBytes(_echoPattern);

            echoClient.OnHostnameResolved += echoClient_OnHostnameResolved;
            echoClient.OnEchoResponse += echoClient_OnEchoResponse;
            echoClient.OnSocketException += echoClient_OnSocketException;
            echoClient.OnFinish += echoClient_OnFinish;
            echoClient.Start();
        }