/// <summary> /// Runs UDP client mode /// </summary> public void Run() { echoReceived = echoCorrupted = echoLost = 0; UdpEchoClient echoClient = new UdpEchoClient(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 UdpEchoClient.HostnameResolvedDelegate(echoClient_OnHostnameResolved); echoClient.OnEchoResponse += new UdpEchoClient.EchoResponseDelegate(echoClient_OnEchoResponse); echoClient.OnSocketException += new UdpEchoClient.SocketExceptionDelegate(echoClient_OnSocketException); echoClient.OnFinish += new UdpEchoClient.FinishDelegate(echoClient_OnFinish); echoClient.Start(); }
/// <summary> /// Runs UDP client mode /// </summary> public void Run() { _echoReceived = _echoCorrupted = _echoLost = 0; var echoClient = new UdpEchoClient(_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(); }