Solved

Checking for NETWORK activity

Posted on 2000-04-17
20
198 Views
Last Modified: 2010-04-04
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...)
0
Comment
Question by:WMPeters
  • 8
  • 5
  • 2
  • +5
20 Comments
 
LVL 6

Expert Comment

by:Jaymol
ID: 2722595
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
 
LVL 6

Expert Comment

by:Jaymol
ID: 2722614
Or alternatively, get it to try and find the server.  If it can't, then it's not connected.
0
 

Author Comment

by:WMPeters
ID: 2722671
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 6

Expert Comment

by:Jaymol
ID: 2722680
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
 

Author Comment

by:WMPeters
ID: 2722710
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
 

Author Comment

by:WMPeters
ID: 2722737
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
 

Author Comment

by:WMPeters
ID: 2722741
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
 
LVL 6

Expert Comment

by:Jaymol
ID: 2722767
If the people that use the network are as good as you say, then there's nothing you can do to stop them.
0
 

Author Comment

by:WMPeters
ID: 2722806
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
 
LVL 6

Accepted Solution

by:
Jaymol earned 100 total points
ID: 2722818
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
 
LVL 2

Expert Comment

by:craig_capel
ID: 2722858
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
 
LVL 1

Expert Comment

by:wmckie
ID: 2723106
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
 

Expert Comment

by:snoopy_Spy
ID: 2724990
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
 
LVL 3

Expert Comment

by:bryan7
ID: 2725294
interesting.. listenning
0
 

Author Comment

by:WMPeters
ID: 2726622
Hello Graiq capel;

The network env. is Novell 4.11, operating with W95 clients. 99% off the network traffic is in IPX
0
 
LVL 1

Expert Comment

by:l8knight
ID: 2756341
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
 

Author Comment

by:WMPeters
ID: 2758466
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
 
LVL 1

Expert Comment

by:l8knight
ID: 2759227
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
 

Author Comment

by:WMPeters
ID: 2787682
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
 

Expert Comment

by:silvamv
ID: 4622494
What´s the Unit that I need to use  CreateGuid function ?

Thank´s.
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question