Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
 public TwitchPingResult(TwitchServer server, TimeSpan ping)
 {
     this.Ping   = ping;
     this.Server = server;
 }
Exemplo n.º 5
0
 public TwitchPingCompletedEventArgs(TwitchServer server, TimeSpan ping)
 {
     this.Server = server;
     this.Ping   = ping;
 }