Checking for NETWORK activity

I want to make a little program, that checks wether the computer is attached to the network or is working as a standalone. If not attached, the computer has to take action, if attached, and during operation disconnected, again, action is neccessary. I do not want to transmit any signal, so i was thinking of a programm which reads the NIC signal activity. It would be nice to check as soon as the computer boots, but during operation, it has to pol too.


REASON :

In the company i work for, computers run with Win 95. It is determind in the policy  that network valdidation is active. Some 'smart' users decide to disconnect the computer, gain access, install (illegal) software and re-attach the computer. Result : Unknown software on client pc's, virusses (record is 97 at one pc !) etc. And nobody knows who did what. Disconnecting Drive's did not help since some 'real smart #sses' have parrallel zip drives.... aaarrghh (i am work as a system administrator at a school...)
WMPetersAsked:
Who is Participating?
 
JaymolConnect With a Mentor Commented:
I can give you code for getting the NIC address, but, to be honest, I don't see why you want it.......here you go...

function GetNicAddr:AnsiString;
var
  T:AnsiString;
  I:Integer;
begin
  Result:='';
  SetLength(T,16);
  if CoCreateGUID(@T[1])=S_OK then begin
    for I:=11 to 15 do Result:=Result+IntToStr(Ord(T[I]))+'.';
    Result:=Result+IntToStr(Ord(T[16]));
  end;
end;

John.
0
 
JaymolCommented:
It's pretty simple really, as long as you have a drive that is mapped on all network connections.

Simply try to access the drive like this....

Try
  Do something on Drive X: (for example)
Except
  Oh, it's not connected!
End

It's not very technical and doesn't give you any network details, but it does tell you whether or not the PC is connected to the network.

John.
0
 
JaymolCommented:
Or alternatively, get it to try and find the server.  If it can't, then it's not connected.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
WMPetersAuthor Commented:
Okay Jaymol,

It is supposed to work, i thought about it too, but...
The only drive a computer is always connected too, even when no login as yet been realized, is the login drive (mostly F: but not always), and there are no writing accesses to this drive, only reading. Those kids here are smart enough to set there portable zipdrives up as a drive with the letter....F:, which was copied from the original. And they can write protect that disk too, so for the system is seems like a network drive.

Thereby;
Not all users have home dir's or writing privileges on the network. Ex. temporary employees, etc. They may only use the phonebook or something like that. (yes, i know, i could check for the existance of that drive too, or for the existance of a combination of drives, but remember the good old SUBST command out of the DOS ages...?)

Thereby, Win 95 is sometimes pretty lame in refreshing...
0
 
JaymolCommented:
You don't need to have write privileges.  You only need read privs.  (Check a file exists.)  These kids that get on there illegaly won't know what file it checks for and where it should be!  That's up to you!  Simply place a file in a specific location and make your software look for it.  They can't fake that unless they can reverse engineer your software.  If they can do that, then there's nothing you can do!

John.
0
 
WMPetersAuthor Commented:
Yes, but that is wat i was meaning with having a copy of the login drive on a zip disk. The only way then is to make a new file every day, reset the filedate to the old, and just hope that they will not use a compare command between multiple copies of multiple files. I know, it seems like a easy solution to a not such difficult problem, but with reading files (and refreshing them every day or so) the network becomes to dependend of me as a administrator (illness, holiday etc) and it still generate traffic. Not much, but with about 500 client pc's seeking for the existing of a special file...aiaiai...can here the complains about the network beings slow allready...and don't forget, the client as to seek about every 2 minutes...
0
 
WMPetersAuthor Commented:
Yes, but that is wat i was meaning with having a copy of the login drive on a zip disk. The only way then is to make a new file every day, reset the filedate to the old, and just hope that they will not use a compare command between multiple copies of multiple files. I know, it seems like a easy solution to a not such difficult problem, but with reading files (and refreshing them every day or so) the network becomes to dependend of me as a administrator (illness, holiday etc) and it still generate traffic. Not much, but with about 500 client pc's seeking for the existing of a special file...aiaiai...can here the complains about the network beings slow allready...and don't forget, the client as to seek about every 2 minutes...
0
 
WMPetersAuthor Commented:
Yes, but that is wat i was meaning with having a copy of the login drive on a zip disk. The only way then is to make a new file every day, reset the filedate to the old, and just hope that they will not use a compare command between multiple copies of multiple files. I know, it seems like a easy solution to a not such difficult problem, but with reading files (and refreshing them every day or so) the network becomes to dependend of me as a administrator (illness, holiday etc) and it still generate traffic. Not much, but with about 500 client pc's seeking for the existing of a special file...aiaiai...can here the complains about the network beings slow allready...and don't forget, the client as to seek about every 2 minutes...
0
 
JaymolCommented:
If the people that use the network are as good as you say, then there's nothing you can do to stop them.
0
 
WMPetersAuthor Commented:
Well, I used to be one of those...:)))
Now i work here, stupid me...

Don't worry, if no better answer comes, you might as well have the points. I'm not going to be difficult about that, i was just hoping that somebody knew how to read out the NIC, and then i do not mean the mac adress, as you know by now.

Whe have a multiserver environment, and since a short time all buildings (70 of them) are linked together... So when the sh*t really hits the fan, i duck...and then it is aproblem off my boss, and pro's can solve it then.

Thanks for youre time and solutions anyway
0
 
craig_capelCommented:
Get a program out to restrict access on every pc.....

What os are you working on, and what software are u using to admin the computers... win98 / Novell / NT.... what are we dealing with?...
0
 
wmckieCommented:
If you're using TCP/IP you could periodicaly ping a known address or group of addresses and if there are a number of consecutive fails then that could indicate a network disconnection. If the packets are small and with a suitable time between pings this shouldn't create too much extra traffic.

A suitable ping component is available in the WinShoes suite or F Piette's ICS suite.

Cheers - Walter McKie
0
 
snoopy_SpyCommented:
Hi WMPeters

You can check the type of your Login Drive (F:\)
With GetDriveType(PChar('F:')); you get the Typ of the Drive which is one of the following Value :
0      The drive type cannot be determined.
1      The root directory does not exist.
DRIVE_REMOVABLE      The drive can be removed from the drive.
DRIVE_FIXED      The disk cannot be removed from the drive.
DRIVE_REMOTE      The drive is a remote (network) drive.
DRIVE_CDROM      The drive is a CD-ROM drive.
DRIVE_RAMDISK      The drive is a RAM disk.
0
 
bryan7Commented:
interesting.. listenning
0
 
WMPetersAuthor Commented:
Hello Graiq capel;

The network env. is Novell 4.11, operating with W95 clients. 99% off the network traffic is in IPX
0
 
l8knightCommented:
Have a look at LanManager.zip from Project Jedi. I'm sure you will find something in the API that will check for network activity without sending any data onto the network.

Hope this helps

regards

l8knight

btw: I know how you feel I used to work at a school. One of the first in Australia with a Laptop programme. Can you imagine 300 laptops in the hands of 300 teenage boys. aaarrrgggghhhh!!!!
0
 
WMPetersAuthor Commented:
Hello I8knight,

Can you also tell me how to get LanManager.zip ?

Can I download it somewhere, or can i find it at my delphi-cd ? (did not find it yet)

300 teenage with 300 laptops....welcome in the system-administrators hell....;))


By the way, i'm closing this question within a few days (closing, not redrawing / taking back).

Greetz, WMP
0
 
l8knightCommented:
G'day WMP,

Sorry, I thought everybody (delphi programmers that is) had heard of Project Jedi, here is the link http://www.delphi-jedi.org/Jedi:APILIBRARY:460582381 

regards

l8knight
0
 
WMPetersAuthor Commented:
Okay, i'm closing the question. Since Jaymol put much effort in answering, and provided some code for the NIC, i feel like its only fair to give him the points. Thanks everbody for taking the time to solve this question. When i make a mixture of all solutions, some real solution is bound to come up.
0
 
silvamvCommented:
What´s the Unit that I need to use  CreateGuid function ?

Thank´s.
0
All Courses

From novice to tech pro — start learning today.