static void Main(string[] args)
        {
            while (true)
            {
                PingReply pingReply = PingOperation.PingResource("svrwww05");
                if (pingReply.Status != IPStatus.Success)
                {
                    Console.WriteLine($"{DateTimeOffset.Now} {pingReply.Status} {pingReply.Address.ToString()} {pingReply.Buffer.Length} {pingReply.RoundtripTime}");
                    Console.WriteLine();
                }
                else
                {
                    //Console.WriteLine($"{DateTimeOffset.Now} {pingReply.Status} {pingReply.Address.ToString()} {pingReply.Buffer.Length} {pingReply.RoundtripTime} {pingReply.Options.Ttl}");
                    Console.Write(".");
                }

                //Console.WriteLine("Address: {0}", reply.Address.ToString());
                //Console.WriteLine("RoundTrip time: {0}", reply.RoundtripTime);
                //Console.WriteLine("Time to live: {0}", reply.Options.Ttl);
                //Console.WriteLine("Don't fragment: {0}", reply.Options.DontFragment);
                //Console.WriteLine("Buffer size: {0}", reply.Buffer.Length);

                Thread.Sleep(1000);
            }
        }
        }                                               // Current ping operation being performed

        public PingAttributes()
        {
            // Default properties
            InputtedAddress      = "";
            ResolvedAddress      = "";
            Message              = Helper.RandomString(26);
            Interval             = 1000;
            Timeout              = 3000;
            Count                = 5;
            Ttl                  = 255;
            Type                 = 0x08;
            Code                 = 0x00;
            ArtificalMessageSize = -1;
            BeepMode             = 0;
            ReceiveBufferSize    = 5096;

            // Default options
            Continous     = false;
            UseICMPv4     = true;
            UseICMPv6     = false;
            RandomMessage = false;
            DontFragment  = false;
            RandomTiming  = false;
            Operation     = PingOperation.Normal;
        }
        public void executeTest()
        {
            Transport     trans  = new TCPTransport(System.Net.IPAddress.Loopback, 11222);
            Codec         codec  = new Codec();
            PingOperation target = new PingOperation(codec, 0, trans);

            PingOperation.PingResult expected = PingOperation.PingResult.SUCCESS;
            PingOperation.PingResult actual;
            actual = target.execute();
            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        /// <summary>
        /// Checks whether the server is alive (throws an exception if not).
        /// </summary>
        public void Ping()
        {
            var messageEncoderSettings = GetMessageEncoderSettings();
            var operation = new PingOperation(messageEncoderSettings);

            var server = GetServer();

            using (var binding = new SingleServerReadBinding(server, ReadPreference.PrimaryPreferred))
            {
                operation.Execute(binding, CancellationToken.None);
            }
        }
Exemple #5
0
        public void PingResource()
        {
            // Act
            PingReply result = PingOperation.PingResource("www.google.com");

            // Log
            Console.WriteLine(result.ToString());
            Console.WriteLine(result.Address.ToString());

            // Assert
            Assert.NotNull(result);
        }
        /// <summary>
        /// Checks whether the server is alive (throws an exception if not).
        /// </summary>
        public void Ping()
        {
            var messageEncoderSettings = GetMessageEncoderSettings();
            var operation = new PingOperation(messageEncoderSettings);

            var server = GetServer();

            using (var channelSource = new ChannelSourceHandle(new ServerChannelSource(server)))
                using (var channelSourceBinding = new ChannelSourceReadWriteBinding(channelSource, ReadPreference.PrimaryPreferred))
                {
                    operation.Execute(channelSourceBinding, CancellationToken.None);
                }
        }
Exemple #7
0
        public PingAttributes(PingAttributes attributes)
        {
            InputtedAddress      = attributes.InputtedAddress;
            ResolvedAddress      = attributes.ResolvedAddress;
            Message              = attributes.Message;
            Interval             = attributes.Interval;
            Timeout              = attributes.Timeout;
            Count                = attributes.Count;
            Ttl                  = attributes.Ttl;
            Type                 = attributes.Type;
            Code                 = attributes.Code;
            ArtificalMessageSize = attributes.ArtificalMessageSize;
            BeepMode             = attributes.BeepMode;
            ReceiveBufferSize    = attributes.ReceiveBufferSize;

            Continous     = attributes.Continous;
            UseICMPv4     = attributes.UseICMPv4;
            UseICMPv6     = attributes.UseICMPv6;
            RandomMessage = attributes.RandomMessage;
            DontFragment  = attributes.DontFragment;
            RandomTiming  = attributes.RandomTiming;
            Operation     = attributes.Operation;
        }
Exemple #8
0
        }                                            // Current ping operation we are performing

        public PingAttributes()
        {
            // Default attributes
            InputtedAddress   = "";
            Address           = "";
            Message           = "R U Alive?";
            Interval          = 1000;
            Timeout           = 3000;
            Count             = 5;
            Ttl               = 255;
            Type              = 0x08;
            Code              = 0x00;
            Size              = -1;
            Continous         = false;
            ForceV4           = true;
            ForceV6           = false;
            RandomMsg         = false;
            BeepLevel         = 0;
            AddressList       = null;
            RecieveBufferSize = 5096;
            DontFragment      = false;
            RandomTiming      = false;
            Operation         = PingOperation.Normal;
        }
        /// <summary>
        /// Checks whether the server is alive (throws an exception if not).
        /// </summary>
        public void Ping()
        {
            var messageEncoderSettings = GetMessageEncoderSettings();
            var operation = new PingOperation(messageEncoderSettings);

            var server = GetServer();
            using (var channelSource = new ChannelSourceHandle(new ServerChannelSource(server)))
            using (var channelSourceBinding = new ChannelSourceReadWriteBinding(channelSource, ReadPreference.PrimaryPreferred))
            {
                operation.Execute(channelSourceBinding, CancellationToken.None);
            }
        }
Exemple #10
0
        /// <summary>
        /// Checks whether the server is alive (throws an exception if not).
        /// </summary>
        public void Ping()
        {
            var messageEncoderSettings = GetMessageEncoderSettings();
            var operation = new PingOperation(messageEncoderSettings);

            var server = GetServer();
            using (var binding = new SingleServerReadBinding(server, ReadPreference.PrimaryPreferred))
            {
                operation.Execute(binding, CancellationToken.None);
            }
        }