Esempio n. 1
0
        private void OnPingCompleted(object sender, PingCompletedEventArgs e)
        {
            PingTaskState state = e.UserState as PingTaskState;

            if (state != null)
            {
                if (e.Cancelled || Executor.Command.Stopping)
                {
                    state.Ping.Dispose();
                    return;
                }

                PingHostInfo result = new PingHostInfo(this, state.IPAddress, e.Reply, e.Error, Buffer.Length);
                Executor.WriteInfo(result);

                if (state.RemainingCount == 0)
                {
                    state.Ping.Dispose();
                }
                else
                {
                    SendAsyncInternal(state);
                }
            }
        }
Esempio n. 2
0
        internal override void WriteInfo(PingHostInfo result)
        {
            lock (syncRoot)
            {
                Statistics.Add(result);
            }

            DecrementItemCount();
        }
Esempio n. 3
0
        internal override void WriteInfo(PingHostInfo result)
        {
            lock (syncRoot)
            {
                Statistics.Add(result);
            }

            DecrementItemCount();
        }
            public void Add(PingHostInfo result)
            {
                IPAddress address = result.Address;

                if (!items.ContainsKey(address))
                {
                    items[address] = new PingHostStatistics(result.HostName, result.HostNameWithAddress, address);
                }

                items[address].Replies.Add(result.Reply);
            }
Esempio n. 5
0
        public void Send()
        {
            using (Ping ping = new Ping())
            {
                foreach (IPAddress ip in Addresses)
                {
                    WriteMessage(ip);

                    for (int i = 0; i < Count; i++)
                    {
                        if (Executor.Command.Stopping)
                        {
                            return;
                        }

                        PingReply reply = null;
                        Exception error = null;

                        try
                        {
                            reply = ping.Send(ip, Timeout, Buffer, PingOptions);
                        }
                        catch (PipelineStoppedException)
                        {
                            throw;
                        }
                        catch (Exception exc)
                        {
                            error = exc;
                        }

                        PingHostInfo info = new PingHostInfo(this, ip, reply, error, Buffer.Length);
                        Executor.WriteInfo(info);
                    }

                    Executor.WriteStatistics(ip);
                }
            }
        }
Esempio n. 6
0
        private void OnPingCompleted(object sender, PingCompletedEventArgs e)
        {
            PingTaskState state = e.UserState as PingTaskState;
            if (state != null)
            {
                if (e.Cancelled || Executor.Command.Stopping)
                {
                    state.Ping.Dispose();
                    return;
                }

                PingHostInfo result = new PingHostInfo(this, state.IPAddress, e.Reply, e.Error, Buffer.Length);
                Executor.WriteInfo(result);

                if (state.RemainingCount == 0)
                {
                    state.Ping.Dispose();
                }
                else
                {
                    SendAsyncInternal(state);
                }
            }
        }
Esempio n. 7
0
 internal override void WriteInfo(PingHostInfo info)
 {
     info.WriteToHost(Command);
     Statistics.Add(info);
 }
Esempio n. 8
0
 internal abstract void WriteInfo(PingHostInfo info);
Esempio n. 9
0
 internal override void WriteInfo(PingHostInfo info)
 {
     info.WriteToHost(Command);
     Statistics.Add(info);
 }
Esempio n. 10
0
        public void Send()
        {
            using (Ping ping = new Ping())
            {
                foreach (IPAddress ip in Addresses)
                {
                    WriteMessage(ip);

                    for (int i = 0; i < Count; i++)
                    {
                        if (Executor.Command.Stopping)
                            return;

                        PingReply reply = null;
                        Exception error = null;

                        try
                        {
                            reply = ping.Send(ip, Timeout, Buffer, PingOptions);
                        }
                        catch (PipelineStoppedException)
                        {
                            throw;
                        }
                        catch (Exception exc)
                        {
                            error = exc;
                        }

                        PingHostInfo info = new PingHostInfo(this, ip, reply, error, Buffer.Length);
                        Executor.WriteInfo(info);
                    }

                    Executor.WriteStatistics(ip);
                }
            }

        }
Esempio n. 11
0
 internal abstract void WriteInfo(PingHostInfo info);