VB Ping

Discussion in 'Programming General' started by syth4, Feb 26, 2007.

VB Ping
  1. Unread #1 - Feb 26, 2007 at 9:55 AM
  2. syth4
    Joined:
    Jan 28, 2007
    Posts:
    173
    Referrals:
    1
    Sythe Gold:
    1

    syth4 Active Member

    VB Ping

    Hi,
    In my last topic I didn't get my question answered...
    how do I make a VB Pinger that pings up to 10 ip speeds then pauses for 15 min then starts again outputting it in a textbox and saving it to a textfile on a shared folder and on the local harddrive. If someone could help me that would be great :)
    Thanks
     
  3. Unread #2 - Feb 26, 2007 at 3:02 PM
  4. Phaethon
    Joined:
    Jan 21, 2007
    Posts:
    245
    Referrals:
    0
    Sythe Gold:
    0

    Phaethon Active Member
    Banned

    VB Ping

    One could only wonder why you would want that :p
     
  5. Unread #3 - Feb 26, 2007 at 4:05 PM
  6. syth4
    Joined:
    Jan 28, 2007
    Posts:
    173
    Referrals:
    1
    Sythe Gold:
    1

    syth4 Active Member

    VB Ping

    I'm the admin of a big network and I need to know the speeds of the connections...
     
  7. Unread #4 - Feb 26, 2007 at 4:10 PM
  8. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    VB Ping

    admin of a big network eh? i would of though u would know how to do this

    anyway just do a google search and u should get some tuts on how to make a trojan :)
     
  9. Unread #5 - Feb 26, 2007 at 6:55 PM
  10. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    VB Ping

    um well you can always acces the router :) (right click the internet thingy at the start menu and below the ip theres some number like 192.157.2.1 or something like that that copy and paste it to the webbrowser and done
     
  11. Unread #6 - Feb 26, 2007 at 8:12 PM
  12. hmm
    Joined:
    Jan 21, 2007
    Posts:
    181
    Referrals:
    2
    Sythe Gold:
    5

    hmm Active Member

  13. Unread #7 - Feb 27, 2007 at 2:03 AM
  14. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    VB Ping

    <3 Mvps :d
     
  15. Unread #8 - Feb 27, 2007 at 5:06 AM
  16. Flaming Idiots
    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User

    Flaming Idiots Active Member
    Visual Basic Programmers

    VB Ping

    I've had to do things like this before, so I made this quickly. This is a console application, but it will work faster than a windows form application.
    This can also only ping computers inside your network.

    To use, make a new console application, an replace all code with this.

    To save to the file, you need to exit it by pressing a key on the keyboard.

    Code:
    Module Module1
    
        Sub Main()
            Dim Ping As New System.Net.NetworkInformation.Ping
            Dim PingList As New List(Of String)
    
            '' Add all addresses you want to ping. This will only work for computers inside your network. Not online.
            PingList.Add("10.10.10.1")
            PingList.Add("10.10.10.2")
            PingList.Add("10.10.10.3")
            PingList.Add("localhost")
    
            '' Set where you want to save here!
            Dim OutputPath As String = "C:\PingOut.txt"
    
            '' Set how often you want to ping (default 15 minutes)
            Dim PingFrequency As New TimeSpan(0, 15, 0)
    
            '' This part will write to the file. Press any key to end this and save the file.
            Dim Output As New IO.StreamWriter(OutputPath, True)
            Console.WriteLine("Saving to " & OutputPath)
            Dim ToOutput As String = String.Format("{0}|{1}|{2}|{3}", _
                FormatString(13, "Time of ping"), _
                FormatString(13, "Address"), _
                FormatString(13, "Time (ms)"), _
                "Status")
            Output.WriteLine(ToOutput)
            Console.WriteLine(ToOutput)
            Output.WriteLine("{0}|{0}|{0}|{0}", FormatString(13, "", "-"))
            Console.WriteLine("{0}|{0}|{0}|{0}", FormatString(13, "", "-"))
            Dim LastTime As Date = Now - PingFrequency - New TimeSpan(0, 1, 0)
            Do
                If Console.KeyAvailable Then Exit Do
                If Now - PingFrequency < LastTime Then Continue Do
                For Each Address As String In PingList
                    Dim Result As Net.NetworkInformation.PingReply = Ping.Send(Address)
                    ToOutput = String.Format("{0}|{1}|{2}|{3}", _
                        FormatString(13, Now.Hour & ":" & Now.Minute & ":" & Now.Second), _
                        FormatString(13, Result.Address.ToString), _
                        FormatString(13, Result.RoundtripTime), _
                        FormatString(13, Result.Status.ToString))
                    Console.WriteLine(ToOutput)
                    Output.WriteLine(ToOutput)
                Next
                Output.WriteLine("{0}|{0}|{0}|{0}", FormatString(13, "", "-"))
                Console.WriteLine("{0}|{0}|{0}|{0}", FormatString(13, "", "-"))
                LastTime = Now
            Loop
            Output.Close()
        End Sub
        Function FormatString(ByVal Count As Integer, ByVal Text As String, Optional ByVal Formater As Char = " ") As String
            For X As Integer = Text.Length To Count
                Text &= Formater
            Next
            Return Text
        End Function
    
    End Module
    
    This is how it will write to the text file and console:
    Code:
    Time of ping  |Address       |Time (ms)     |Status
    --------------|--------------|--------------|--------------
    2:54:41       |10.10.10.1    |1             |Success       
    2:54:41       |10.10.10.2    |2             |Success       
    2:54:41       |10.10.10.3    |1             |Success       
    2:54:41       |::1           |0             |Success       
    --------------|--------------|--------------|--------------
    
     
  17. Unread #9 - Mar 1, 2007 at 9:39 AM
  18. syth4
    Joined:
    Jan 28, 2007
    Posts:
    173
    Referrals:
    1
    Sythe Gold:
    1

    syth4 Active Member

    VB Ping

    Hey Flaming Idiots...
    Your source didn't work it said:

    [​IMG]

    Thanks :)
     
< need a client tutorial | =] Sig Generator >

Users viewing this thread
1 guest


 
 
Adblock breaks this site