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