示例#1
0
        public TimeSpan Ping(TwitchServer server)
        {
            var tcpClient = new TcpClient();
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            tcpClient.Connect(server.Url, rtmpPort);
            stopWatch.Stop();

            tcpClient.GetStream().Close();
            tcpClient.Close();
            return(stopWatch.Elapsed);
        }
示例#2
0
        public async void PingAsyncVoid(TwitchServer server)
        {
            var tcpClient = new TcpClient();
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            await tcpClient.ConnectAsync(server.Url, rtmpPort);

            stopWatch.Stop();

            OnPingCompleted(new TwitchPingCompletedEventArgs(server, stopWatch.Elapsed));
            tcpClient.GetStream().Close();
            tcpClient.Close();
        }
示例#3
0
        public async Task <TwitchPingResult> PingAsyncTaskArgs(TwitchServer server)
        {
            var tcpClient = new TcpClient();
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            await tcpClient.ConnectAsync(server.Url, rtmpPort).ConfigureAwait(false);

            stopWatch.Stop();

            tcpClient.GetStream().Close();
            tcpClient.Close();
            return(new TwitchPingResult(server, stopWatch.Elapsed));
        }
示例#4
0
 public TwitchPingResult(TwitchServer server, TimeSpan ping)
 {
     this.Ping   = ping;
     this.Server = server;
 }
示例#5
0
 public TwitchPingCompletedEventArgs(TwitchServer server, TimeSpan ping)
 {
     this.Server = server;
     this.Ping   = ping;
 }