DB Data Computer.Network.PING DO WHILE loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SyGC
    New Member
    • Feb 2008
    • 17

    DB Data Computer.Network.PING DO WHILE loop

    Greetings All,

    I have established a working Remote Connection to a MySQL DB using ODBC which allows me to select data in a Datagridview in my Form. The data is a list of IP addresses. What i want to do is take each IP address, parse it to My.Computer.Net work.Ping if the result returns false then the IP address is diaplayed in a TextBox1. If the result is true then the IP address is either disgarded or displayed in another TextBox field.

    Fairly simple IF ELSE statement which i think needs to be used in conjunction with a DO WHILE loop.

    Due to thier being numerous IP addresses to Ping the loop would be placed in a seperate thread and the actual Ping arguements altered accordingly (timeout etc)

    I think with this i need some direction is the best way to get started,

    Any thoughts?

    Thanks in advance as always,

    Sy
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    It seems like you have the right idea. (A seperate thread of sorts would be needed to keep things moving along)
    You have the IP addresses.
    You have the PING section available to you.
    You know what to do for successfull pings and unsuccessfull pings


    Just give it a shot and see what comes out.
    I might suggest that use a "pool" of some number of threads, and some mechanism to feed them IP addresses as needed. But that is a bit overly complex at this point I thjink.

    Comment

    • SyGC
      New Member
      • Feb 2008
      • 17

      #3
      Originally posted by Plater
      It seems like you have the right idea. (A seperate thread of sorts would be needed to keep things moving along)
      You have the IP addresses.
      You have the PING section available to you.
      You know what to do for successfull pings and unsuccessfull pings


      Just give it a shot and see what comes out.
      I might suggest that use a "pool" of some number of threads, and some mechanism to feed them IP addresses as needed. But that is a bit overly complex at this point I thjink.
      Hi Plater,

      yea im giving it a go as we speak. I think the issue at the moment is extracting the IP Addresses from the Datagridview to parse to the Network.Ping.

      Anyway ill crack on! Any suggestions though feel free! :P

      Sy

      Comment

      • SyGC
        New Member
        • Feb 2008
        • 17

        #4
        Originally posted by SyGC
        Hi Plater,

        yea im giving it a go as we speak. I think the issue at the moment is extracting the IP Addresses from the Datagridview to parse to the Network.Ping.

        Anyway ill crack on! Any suggestions though feel free! :P

        Sy
        Hello All,

        Ive been able to extract the IP Addresses from my data set and parse them to an array which in turn parses them to the Network.Ping method running in a WHILE loop in a seprate thread. Ive then pointed the the results from the Network.Ping method (True/False) displaying the IP address if returning False in a textbox field. However all i want to do is simply return line each time an IP address is parsed to a textbox field. Ive looked into using a list box but cannot get the IP addresses to be shown as its "items"

        Code:
        Dim resultip As String
        IpResListBox1.Items.IsReadOnly = resultip
        Above this throws the error 'IsReadonly'

        Code:
        Dim resultip As String
        Pingable_Results_IP_TextBox1.Text = resultip
        Above returns the IP Address meeting the Ping arguement however doesnt return line and instead replaces the first IP Address with the second.

        Any Thoughts? (Its so simple i know...ive had a bad week...if not a usual week)

        Sy

        Comment

        • balabaster
          Recognized Expert Contributor
          • Mar 2007
          • 798

          #5
          Originally posted by SyGC
          Hello All,

          Ive been able to extract the IP Addresses from my data set and parse them to an array which in turn parses them to the Network.Ping method running in a WHILE loop in a seprate thread. Ive then pointed the the results from the Network.Ping method (True/False) displaying the IP address if returning False in a textbox field. However all i want to do is simply return line each time an IP address is parsed to a textbox field. Ive looked into using a list box but cannot get the IP addresses to be shown as its "items"

          Code:
          Dim resultip As String
          IpResListBox1.Items.IsReadOnly = resultip
          Above this throws the error 'IsReadonly'

          Code:
          Dim resultip As String
          Pingable_Results_IP_TextBox1.Text = resultip
          Above returns the IP Address meeting the Ping arguement however doesnt return line and instead replaces the first IP Address with the second.

          Any Thoughts? (Its so simple i know...ive had a bad week...if not a usual week)

          Sy
          Set your textbox to multiline. The textbox can now be populated as an array of string - check out the example below:
          Code:
          Dim MyStrings() As String = New String() {"Line1", "Line2", "Line3", "Line4"}
          TextBox1.Lines = MyStrings
          The other way is a listbox...you can't just set the listbox to show the items in that fashion.
          For instance
          Code:
          Dim MyList As List(Of Item)
          ListBox1.Items = MyList
          won't work...and will result in your readonly error.
          However:
          Code:
          For Each sItem As String in MyList
            ListBox1.Items.Add oItem
          Next
          will work just fine.

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            You could use DataGridView and use your DataSet as the DataSource.
            Then cycle through your DataTable (instead of pushing them to another array) and just update a 2nd column about if it could ping the address or not.

            Comment

            Working...