How to check a network server is available

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Li Pang

    How to check a network server is available

    Hi

    Anybody knows how to check a network server is available (pingable)

    Many thanks in advance.
  • Herfried K. Wagner [MVP]

    #2
    Re: How to check a network server is available

    * "=?Utf-8?B?TGkgUGFuZw= =?=" <anonymous@disc ussions.microso ft.com> scripsit:[color=blue]
    > Anybody knows how to check a network server is available (pingable)?[/color]

    Sample in C#:

    <http://www.c-sharpcorner.com/network/ping.asp>

    --
    Herfried K. Wagner [MVP]
    <http://www.mvps.org/dotnet>

    Comment

    • Cor

      #3
      Re: How to check a network server is available

      Hi Li Pang,

      Will you try this and message us if it works, I am in doubt, because I
      thought that Ken did distribute this, but he did not send it to you.

      Dim hostInfo As System.Net.IPHo stEntry
      hostInfo = System.Net.Dns. GetHostByAddres s("xxx.xxx.xxx. xxx") ' a fixed
      server IP
      MessageBox.Show (hostInfo.HostN ame)

      Cor


      Comment

      • Cor

        #4
        Re: How to check a network server is available

        Hi Li Pang,

        If you than test the name of the server it should go is my thought than or
        does it give the name anyway from the registry or someting?.

        Cor[color=blue]
        >
        > Your codes work for getting host name, but can't manage if the server is[/color]
        not pingable.[color=blue]
        >
        > Dim hostInfo As System.Net.WebR equest
        > Try
        > hostInfo = System.Net.Dns. GetHostByAddres s("xxx.xxx.xxx. xxx")
        > Catch exc As Exception
        > MessageBox.Show (exc.ToString)
        > Exit Sub
        > End Try
        >
        > no error catch if the server is disconnected from the network.
        >
        > Li Pang[/color]


        Comment

        • Cor

          #5
          Re: How to check a network server is available

          Hi Li,

          Than this methode is unusable.

          Thanks.

          Cor[color=blue]
          >
          > The hostname is populated either the server is available or not.[/color]


          Comment

          • Li Pang

            #6
            Re: How to check a network server is available

            Hi Herfried K. Wagner

            Is PingHost method is available in VB
            The pinghost function is similar to Cor's VB codes, and I can't figure out how to manage if the server is not available


            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: How to check a network server is available

              * "=?Utf-8?B?TGkgUGFuZw= =?=" <anonymous@disc ussions.microso ft.com> scripsit:[color=blue]
              > Is PingHost method is available in VB?
              > The pinghost function is similar to Cor's VB codes, and I can't figure
              > out how to manage if the server is not available.[/color]

              You will have to translate the C# code to VB.NET, for example by using
              these converters:

              <http://www.remotesoft. com/>
              -> "Octopus"

              C# -> VB .NET Converters:

              <http://www.kamalpatel. net/ConvertCSharp2V B.aspx>
              <http://csharpconverter .claritycon.com/Default.aspx>
              <http://www.ragingsmurf .com/vbcsharpconvert er.aspx>
              <http://www.aspalliance .com/aldotnet/examples/translate.aspx>

              --
              Herfried K. Wagner [MVP]
              <http://www.mvps.org/dotnet>

              Comment

              • Cor

                #8
                Re: How to check a network server is available

                Hi Herfried,

                Now I remember me again how I got this code, I translated it.

                That was what Li said.

                I have dumped it now from my HKW system.

                Cor


                Comment

                • Paul Clement

                  #9
                  Re: How to check a network server is available

                  On Fri, 20 Feb 2004 02:56:04 -0800, "Li Pang" <anonymous@disc ussions.microso ft.com> wrote:

                  ¤ Hi,
                  ¤
                  ¤ Anybody knows how to check a network server is available (pingable)?
                  ¤

                  See the following MS KB article:

                  How to ping an IP address by using sockets in Visual Basic .NET



                  Paul ~~~ pclement@amerit ech.net
                  Microsoft MVP (Visual Basic)

                  Comment

                  • Li Pang

                    #10
                    RE: How to check a network server is available

                    The codes in this link work for me

                    Comment

                    • Cor

                      #11
                      Re: How to check a network server is available

                      Hi Ping,

                      Thanks for your answer,

                      Cor


                      Comment

                      Working...