Source language: Translate to:

anyway to check if computer is connected to the network?

General questions about NeoBook

Moderator: Neosoft Support

anyway to check if computer is connected to the network?

Postby yanzco » Tue Apr 04, 2017 8:20 am

uhm, is there any way or quick way to check if the computer is connected to the server?
let's say that the ip of the server is given..

my current way i have made is a bit experimental..
but i am looking for a better or better way to do it.


my way is
having a server app on a loop to try and detect a file shared by a 'client' computer in a 'client' directory...
if found that file... the server writes line 1 on that file to 'connected'

the client every 5 minutes creates thesame specific file with line 1 'checking connection'
client checks line 1 if it changes...

this way, if the file never gets updated to connected, the app will know it is not connected...



a very funny way, works, but not all the time i think.. but takes time...
and i need a faster way, or something like realtime way of checking...

and i think the loops are a bit processor heavy? i dont know, its a separate tiny app that is loaded by the main app..
but what do you think?...
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am

Re: anyway to check if computer is connected to the network?

Postby dpayer » Tue Apr 04, 2017 8:40 am

There are different processes that can be used for a local network than for an Internet based server.

On a local network (LAN using windows networking) you should be able to determine if a file simply exists via a path:
Syntax: [ Download ] [ Hide ]
Using Neobook Syntax Highlighting
FileExists "[path2file]" "[ExistsFile]"
Parsed in 0.005 seconds, using GeSHi 1.0.8.10


If it is an Internet based server, using the webserver to reach to the desired path to a file would be my choice:

Syntax: [ Download ] [ Hide ]
Using Neobook Syntax Highlighting
InternetFileExists "[InternetPath2File]" "[InternetFileExists]" ""
Parsed in 0.005 seconds, using GeSHi 1.0.8.10


You don't need to store anything. Just see if the path is open. If open, you're networked.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: anyway to check if computer is connected to the network?

Postby yanzco » Tue Apr 04, 2017 9:13 am

okaaaayyy,,, i never have thought of that...

FileExists.... *laughs
now this will make things alot better..

thanks dpayer
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron