Note that there are some explanatory texts on larger screens.

plurals
  1. POPing.SendAsync() returned replay from 0.0.0.0, how to get pinged address?
    primarykey
    data
    text
    <p>i have problem with Ping.SendAsync() function in C#. I ping some ip adresses, but some of they are wrong. I need to remove wrong adresses from list. But how, because p_PingCompleted <em>event args.replay.adress</em> is <em>0.0.0.0</em>? Here is my code:</p> <pre><code>System.Collections.Generic.List&lt;Game&gt; GameList = new System.Collections.Generic.List&lt;Game&gt;(); System.Timers.Timer timer = new System.Timers.Timer(5000); public StartServer() { this.tcpListener = new TcpListener(IPAddress.Any, 8888); this.listenThread = new Thread(new ThreadStart(ListenForClients)); this.listenThread.Start(); Console.WriteLine("Master server running..."); timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer.Start(); } void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Game[] games = GameList.ToArray(); foreach (Game curgame in games) { System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping(); p.PingCompleted += new System.Net.NetworkInformation.PingCompletedEventHandler(p_PingCompleted); p.SendAsync(IPAddress.Parse(curgame.IP), new object()); } SendMessageToAll(output); Console.WriteLine("Timer.Elapsed with data [" + output + "]"); } void p_PingCompleted(object sender, System.Net.NetworkInformation.PingCompletedEventArgs e) { Console.WriteLine("Ping reply from: " + e.Reply.Address.ToString() + " has " + e.Reply.RoundtripTime.ToString() + " ms."); if (e.Reply.RoundtripTime == 0 || e.Reply.RoundtripTime &gt;= 2500) { Console.WriteLine(" Removing this server because ping is 0 or is greater than 2500 ms"); } } </code></pre> <p>And output is:</p> <blockquote> <pre><code>Pinging 16.5.4.3... Ping reply from: 0.0.0.0 has 0 ms. </code></pre> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload