forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Detect local network?
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Wed Jul 01, 2009 12:12 am    Post subject: Reply with quote

Quote:
@equal(@Dnet(GetIP),127.0.0.1) @equal(@Dnet(GetIPs),127.0.0.1)
This only tells if there is an adapter with an address of 127.0.0.1 (localhost) or not.

I can think of serveral reasons why this won't work. Just because you don't have an ip of 127.0.0.1 doesn't mean you're on a network.

As to the reliability of reading the registry in this case reading info from the TCPIP service itself is highly reliable. Note: The use of reading from the registry was never intended for checking connectivity. I only provided it as a substitute for getting the info associated with the adapter.

As for testing connectivity to the internet I like the API method or with VDS 6.x using @file(http://www.microsoft.com)

Garrett, how often does your app need to check for connectivity?
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Wed Jul 01, 2009 3:54 am    Post subject: Reply with quote

Aslan wrote:
Garrett, how often does your app need to check for connectivity?


Only when the user feels like checking it. Basically, I'm just making a console app. So when I feel like it, for no reason at all, I can type "CHECK NETWORK" or "CHECK INTERNET" and see if either or both are connected or not. Really, for other reason than to have something to play with in a console window. Smile

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed Jul 01, 2009 1:51 pm    Post subject: Reply with quote

Garrett,
Why don't you just ping something (i.e. ... www.google.com and your router Gateway IP) If ping does not resolve then your not online? I think vdsipp.dll has a command for that? Also if your network is going down so often that you are building an application then you need to do some network troubleshooting and replace network devices Razz

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Wed Jul 01, 2009 4:32 pm    Post subject: Reply with quote

dragonsphere wrote:
Garrett,
Why don't you just ping something (i.e. ... www.google.com and your router Gateway IP) If ping does not resolve then your not online? I think vdsipp.dll has a command for that? Also if your network is going down so often that you are building an application then you need to do some network troubleshooting and replace network devices Razz


The @file(http://www.microsoft.com/) code in VDS 6 does just fine for checking internet. I just wanted a way to specifically check the network. You see, you can be disconnected from the internet and still be connected to your LAN.

And my network doesn't go down at all, and the internet rarely ever goes down. As I said, I'm making such a trivial program here, it's not something that's really needed. I'm just taking a break from another project that I've been working on for a few months now. I needed a distraction from the other project, so I dusted off an old freeware program called "eConsole" which can be glued to your desktop and give the effect that it's built in to the desktop since it can look like it's see through. So I started making this little console app for checking things.

Right now it checks:

Code:
+============================================================================+
| Contriviole - Check                                        Version 0.0.0.1 |
+============================================================================+
|          Available commands in Check are:                                  |
|                                                                            |
|               Current date:           DATE                                 |
|               Current time:           TIME                                 |
|               Date and time:          DATETIME or DT                       |
|               24 hour time:           MILITARY or MT or 24                 |
|               Timezone:               TIMEZONE or TZ                       |
|               Calendar:               CALENDAR or CAL                      |
|               Network:                NETWORK or NET                       |
|               Internet:               INTERNET or WWW                      |
|               Memory:                 MEMORY or MEM                        |
|               Drives:                 DRIVES or DRV                        |
|               Running Programs:       PROGRAMS or PROGS or APPS            |
|               Running tasks:          TASKS                                |
|               Windows version:        VERSION or VERS or VER               |
|                                                                            |
+----------------------------------------------------------------------------+


The program is so trivial, that it's even part of the name! Console + Trivial = Contriviole
"Contriviole - The trivial console utilities suite!"

I was thinking of adding a "Fortune" section too. "CHECK FORTUNE" and you'd get one of them silly fortunes back.

Another module of this suite is the "RUN" module which will allow you to launch a program by a single name only, such as 'RUN FIREFOX" and Firefox would start. It requires that you put the name and path to the program in an ini file though, so it's not some secret, mystical technology of searching for programs instantly. It will also do some other things, like shut your pc down, reboot etc.. You know, all the typical little things, or not typical little things.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
briguy
Contributor
Contributor


Joined: 09 Aug 2007
Posts: 79

PostPosted: Wed Jul 01, 2009 8:16 pm    Post subject: Reply with quote

Have you tried at the command line: WMIC (enter) then doing a (?) then checking out the commands or just using (NIC) then (enter) look for the NetConnectionStatus.. have to do all this trough the pipe command but could work..

Anyway the WMIC command is super powerful.. thought I would share.
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed Jul 01, 2009 8:50 pm    Post subject: Reply with quote

Well you can always do the same with GadgetX and WMI but then it would be more of a large project and not just something for Garrett to do for the fun of it and make the rest of us spend time trying to figure out something that he is going to use once or twice and that's it Razz lol
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
briguy
Contributor
Contributor


Joined: 09 Aug 2007
Posts: 79

PostPosted: Thu Jul 02, 2009 4:17 pm    Post subject: Reply with quote

I was playing around with the WMIC and you could do something like the below..


Code:

run cmd.exe /c WMIC NIC get netconnectionid@chr(44)netconnectionstatus@chr(44)netenabled,PIPE,WAIT 10
%P = @PIPE()



Output would look something like the below.. you will have to do an @equal to find what you want or parse it out or something.
seperator-----------------------------------------------------------------

NetConnectionID NetConnectionStatus NetEnabled




Local Area Connection 2 TRUE

seperator------------------------------------------------------------------

Also to let you know the

NetConnectionStatus = 7 when disconnected 2 when connected.

NetEnabled = TRUE when connected and FALSE when disconnected.

with WMIC you can output to XML with the /output: option. then use vds to work with the XML

[/code]
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Thu Jul 02, 2009 5:28 pm    Post subject: Reply with quote

dragonsphere wrote:
Well you can always do the same with GadgetX and WMI but then it would be more of a large project and not just something for Garrett to do for the fun of it and make the rest of us spend time trying to figure out something that he is going to use once or twice and that's it Razz lol


Awwww.. Ya know I was gonna share this with everyone once I was done. Then all this effort will have some meaning for those who participated or are interested. That, and looking over the posts of years gone by shows that we never did really come up with a solution to this one. So this thread also serves as a potential solution to this long lasting problem of checking for the network connection itself.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Thu Jul 02, 2009 5:31 pm    Post subject: Reply with quote

briguy, thanks for the suggestion, I'll give it a try as soon as I can.
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Jul 04, 2009 4:45 pm    Post subject: Reply with quote

briguy, the only problem with WMI is the following:
Quote:
wmic.exe is available on Windows XP Pro. It is not available on Windows 2000 or XP Home.

_________________
cheers

Dave
Back to top
View user's profile Send private message
briguy
Contributor
Contributor


Joined: 09 Aug 2007
Posts: 79

PostPosted: Mon Jul 06, 2009 12:27 pm    Post subject: Reply with quote

Dave,

Good point.. but why would anyone run old OS's lol
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Jul 06, 2009 3:24 pm    Post subject: Reply with quote

briguy wrote:
Dave,

Good point.. but why would anyone run old OS's lol


I think that many people here on vdsworld are still using Win 9x and Win ME Wink or they need their applications to work with Win 9x and Win ME because they support legacy hardware/software.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Mon Jul 06, 2009 3:34 pm    Post subject: Reply with quote

I know another developer who has a few apps out there and he still works on Windows98 only.
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
briguy
Contributor
Contributor


Joined: 09 Aug 2007
Posts: 79

PostPosted: Mon Jul 06, 2009 3:43 pm    Post subject: Reply with quote

9x I could see but WinME uhh... I had sooo much trouble with that OS. Crashed more then OS2 with the wrong drivers then again that was a way long time ago not even sure it crahed maybe not booted.
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2150
Location: A House

PostPosted: Mon Jul 06, 2009 3:46 pm    Post subject: Reply with quote

briguy wrote:
9x I could see but WinME uhh... I had sooo much trouble with that OS. Crashed more then OS2 with the wrong drivers then again that was a way long time ago not even sure it crahed maybe not booted.


Don't be too hard on ME. As a default install, yes, it had problems... But!!! If you were a bit adventurous, you could easily turn ME into one of the most stable systems. Which is what I did once.. Tore the guts out of it a bit and used ME as a Web Hosting box for about 100 web sites. Ran it for a few years too and only rebooted once every 6 months just to reboot it and not because it needed a reboot. But yeah, wasn't so hot for the average user who didn't know how to tweak things Sad

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group