#44844 - 2003-09-05 04:28 PM
How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Hi guys,
I am looking for a consistant way to check if a workstation is on the network, or not. (not by just using @IPADRESS0)
Regards
|
|
Top
|
|
|
|
#44846 - 2003-09-05 04:32 PM
Re: How to check the connection to the local network ?
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
What do you mean by "on the network"? Also do you want the check done from a central server or at the client?
|
|
Top
|
|
|
|
#44847 - 2003-09-05 04:37 PM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Not a nice way
I am using this to check at the login the exectue different kind of login script (network, modem or stand alone).
henri@kixtart.nl told me that someone already post something about my question :
Forum: starters Subject: How to check the connection to the local network ? Who Replied: Jack Lothian
|
|
Top
|
|
|
|
#44848 - 2003-09-05 04:39 PM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Sorry for the end of my answer.
|
|
Top
|
|
|
|
#44851 - 2003-09-05 05:19 PM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Well, sorry for my poor english, I will try to be clear
We have W2K Prof as OS. I defined the Local Policy for the user to execute the login script at the connection.
I completely bypass the netlogon process so I can My login script is working has following :
When a user opens a session, the script defined in the policy is executed locally on the station.
I check if the station is on the network, on RAS or stand alone. If it is on the network, I check which subnet it is, affect the server file depending on the subnet, then I update on the station all the required files to be executed for a RAS or stand alone session then I do what a login script is for - install sofware - mount share drivers /printers - configure desktop ...
If it is a RAS session, I just mount the shares and configure the desktop or a stand alone session, I just configure the desktop
I am just looking for a nice way to rapidly check what kind of session it is. I already use @IPADRESS0, but in some case the result is not good (still the network adress) and the script need to be run twice to get the rignt value Exemple: network session : 192.0.0.1 RAS session : 192.250.0.1 stand alone : 127.0.0.1 or EMPTY Is it more clear
|
|
Top
|
|
|
|
#44853 - 2003-09-05 05:34 PM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Well, I will put just the piece of code where I try to check connexion
... code:
; ; Get the Current IP Adress ; $IPAddress = @IPADDRESS0 $oct1 = LTRIM(SUBSTR($IPAddress, 1, 3)) $oct2 = LTRIM(SUBSTR($IPAddress, 5, 3)) $oct3 = LTRIM(SUBSTR($IPAddress, 9, 3)) $oct4 = LTRIM(SUBSTR($IPAddress, 13, 3)) $IPAdress = "$oct1.$oct2.$oct3.$oct4" $oct1_int=0+$oct1 $oct2_int=0+$oct2 $oct3_int=0+$oct3 $oct4_int=0+$oct4 ; ; ; SET "ModeConnexion=" SELECT CASE $oct1_int=127 Set "ModeConnexion=AUTONOME" $MODECONNEXION="AUTONOME" GOTO AUTONOME CASE $oct1_int=10 IF ($oct2_int<>200) Set "ModeConnexion=RESEAU" $MODECONNEXION="RESEAU" GOTO RESEAU ELSE Set "ModeConnexion=MODEM" $MODECONNEXION="MODEM" GOTO MODEM ENDIF CASE 1 Set "ModeConnexion=MODEM" $MODECONNEXION="MODEM" GOTO MODEM ENDSELECT ...
|
|
Top
|
|
|
|
#44855 - 2003-09-05 05:44 PM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
thanks i'll try it
|
|
Top
|
|
|
|
#44858 - 2003-09-08 08:27 AM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Sometimes I have nothing, sometimes I have address given by the OS (192.????) as I remember, sometimes I have 127.0.0.1
|
|
Top
|
|
|
|
#44860 - 2003-09-08 08:42 AM
Re: How to check the connection to the local network ?
|
Philippe
Fresh Scripter
Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
|
Thank you for your info. I will work in that direction
|
|
Top
|
|
|
|
#44861 - 2003-09-08 09:57 AM
Re: How to check the connection to the local network ?
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
quote: 127.0.0.1 should come only when computer has never been assigned an IP... well, AFAIK
Not quite. The 127.0.0.1 address is the loopback address, and this will always be present in the TCP/IP stack, although it should never be bound to a card. If you issue a "route print" you will see the 127.0.0.0 network and the 127.0.0.1 address.
It is a very important address, as it is effectively internal to your TCP/IP stack. This means (for instance) that you can test that you have networking installed by pinging this address, even if you don't have an active LAN or dial-up connection.
You can also develop network applications / web pages and whatever else while offline.
When you are connecting network applications on the same machine, such as a web browser and server, or an application to a database via pipes or ODBC you should always use the loopback address. This way the traffic won't hit the card and/or the network, and processing will be far faster.
|
|
Top
|
|
|
|
#44863 - 2003-09-09 12:08 AM
Re: How to check the connection to the local network ?
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
just ping the default GW.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 874 anonymous users online.
|
|
|