![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Not a user?
Join Date: Sep 2007
Posts: 254
Rep Power: 1
![]() |
Pinger suggestions?
I've wrote a little program to ping servers and report the results. I'd be interested in ways I could have done it better if you don't mind.
vb Syntax (Toggle Plain Text)
|
|
|
|
|
|
#2 |
|
Not a user?
Join Date: Sep 2007
Posts: 254
Rep Power: 1
![]() |
Re: Pinger suggestions?
Well, it's a rare occasion when a new programmer does it absolutely right.
|
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
Re: Pinger suggestions?
To me, another relatively new programmer (only been doing it about 2 years) it looks fine. I'd always try to comment my code a bit more though.
I'll see if some of the more experienced guys have comments though.... |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,827
Rep Power: 5
![]() |
Re: Pinger suggestions?
You want comments of course.
With reference to functionality, I couldn't say; I've never written a pinger before. If you wanted to get nifty and write very little code, just use the ping system command: ping -n 1 -w 2000 google.ca Which could be used in Visual Basic like so: VB Syntax (Toggle Plain Text)
This way's a lot simpler because it handles all exceptions for you. If the ping doesn't work, ping.exe handles that for you. And if you want to get nit-picky, I'd turn Chr(13) & Chr(10) into a constant, CRLF (if the constant does not already exist), and reference that, instead of having that annoying code repeating 3-4 times. Especially since CRLF is often something you want to change.Then turn your PadRight 30's and 20's into some sort of constant MarginRight variable, and base your calculations off that.Finally, your ping timeout of 2000ms could be user defined as a textCtrl or slider in the Graphical Interface, or referenced as another constant, PingTimeout.Last edited by Sane; Jan 3rd, 2008 at 8:58 AM. |
|
|
|
|
|
#5 |
|
Not a user?
Join Date: Sep 2007
Posts: 254
Rep Power: 1
![]() |
Re: Pinger suggestions?
Shell opens a command window? I'd rather keep the open windows to a minimum, seems to be less things to cause problems since there will be more than one person accessing the computer this will be running on. Also, some of these people are not very technically astute, even after "training".
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,827
Rep Power: 5
![]() |
Re: Pinger suggestions?
There should be a way to pipe the output of ping.exe right into a variable you can even use, without any other windows opening.
Look for popen or something. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Building up a good portfolio - Suggestions? | kruptof | Coder's Corner Lounge | 3 | Jun 9th, 2007 8:39 AM |
| Not encoding nor zip - suggestions | markbadger | Other Programming Languages | 2 | Dec 29th, 2005 8:41 AM |
| Any Suggestions? | dannyp | Python | 4 | Aug 2nd, 2005 6:23 PM |
| Database suggestions | some1 | C++ | 9 | Mar 25th, 2005 3:02 PM |
| Code suggestions | Mad_guy | Perl | 0 | Feb 18th, 2005 10:31 PM |