Click here to Skip to main content
15,912,977 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex24-Aug-21 6:09
samflex24-Aug-21 6:09 
Hi David and thanks a lot for your response.

When you say to pass the URL as command line argument, do you mean when scheduling the app to run?

This is all new for me unfortunately and I ask that you guys forgive me for the questions if they appear silly as probably are.

//UPDATE:

I tried changing the code to the one below so user doesn't have to be prompted to enter URL:

using System;
using System.Net.NetworkInformation;
using System.Text;

namespace showserverstatus
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.Write("Enter server url:");
            //var url = Console.ReadLine();
            //Console.Clear();
            //ServerStatusBy(url);
            //Console.ReadLine();
        }

        public static void ServerStatusBy()
        {
            Ping pingSender = new Ping();

            // Create a buffer of 32 bytes of data to be transmitted.
            string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
            byte[] buffer = Encoding.ASCII.GetBytes(data);

            // Wait 10 seconds for a reply.
            int timeout = 10000;

            PingOptions options = new PingOptions(64, true);

            // Send the request.
            PingReply reply = pingSender.Send("www.yahoo.com", timeout, buffer, options);


            if (reply.Status == IPStatus.Success)
            {
                Console.WriteLine("IP 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);
            }
            else
                Console.WriteLine(reply.Status);
        }

    }


I got the following:

Press any key to continue...

When I do, the console closes.

No records shows.

modified 24-Aug-21 23:19pm.

GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 4:18
samflex25-Aug-21 4:18 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
David Mujica25-Aug-21 5:24
David Mujica25-Aug-21 5:24 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 6:09
samflex25-Aug-21 6:09 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming25-Aug-21 6:18
mveRichard Deeming25-Aug-21 6:18 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex25-Aug-21 8:23
samflex25-Aug-21 8:23 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming25-Aug-21 22:12
mveRichard Deeming25-Aug-21 22:12 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex26-Aug-21 3:04
samflex26-Aug-21 3:04 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming26-Aug-21 3:52
mveRichard Deeming26-Aug-21 3:52 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex26-Aug-21 4:04
samflex26-Aug-21 4:04 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex26-Aug-21 5:08
samflex26-Aug-21 5:08 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming26-Aug-21 5:19
mveRichard Deeming26-Aug-21 5:19 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex26-Aug-21 6:41
samflex26-Aug-21 6:41 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming26-Aug-21 21:28
mveRichard Deeming26-Aug-21 21:28 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
samflex27-Aug-21 3:21
samflex27-Aug-21 3:21 
GeneralRe: I am having problem creating a script to monitor Rest/API services. Pin
Richard Deeming27-Aug-21 4:10
mveRichard Deeming27-Aug-21 4:10 
General(SOLVED) Re: I am having problem creating a script to monitor Rest/API services. Pin
samflex27-Aug-21 5:27
samflex27-Aug-21 5:27 
QuestionBest, cheap, ASP.NET Core hosting? Pin
Chris Maunder4-Aug-21 8:36
cofounderChris Maunder4-Aug-21 8:36 
AnswerRe: Best, cheap, ASP.NET Core hosting? Pin
jkirkerx11-Aug-21 11:15
professionaljkirkerx11-Aug-21 11:15 
GeneralRe: Best, cheap, ASP.NET Core hosting? Pin
Chris Maunder11-Aug-21 11:56
cofounderChris Maunder11-Aug-21 11:56 
GeneralRe: Best, cheap, ASP.NET Core hosting? Pin
jkirkerx11-Aug-21 12:50
professionaljkirkerx11-Aug-21 12:50 
AnswerRe: Best, cheap, ASP.NET Core hosting? Pin
Deepak Vasudevan13-Sep-21 21:42
Deepak Vasudevan13-Sep-21 21:42 
GeneralRe: Best, cheap, ASP.NET Core hosting? Pin
Chris Maunder14-Sep-21 4:38
cofounderChris Maunder14-Sep-21 4:38 
AnswerRe: Best, cheap, ASP.NET Core hosting? Pin
Moo v This17-Nov-21 2:53
Moo v This17-Nov-21 2:53 
Questionhow to run default page as login page in web app blazor Pin
Member 1129177422-Jul-21 2:54
Member 1129177422-Jul-21 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.