Click to See Complete Forum and Search --> : Challenging problem for Remote Access (NT 4.0) : Enforcing a restriction on connection time


dcturner
October 6th, 1999, 04:11 AM
I am trying to write an application which will restrict the amount of time that a computer can be connected using a Remote Access Service (RAS). At the moment, I have a dialog box which replaces the standard Dial-Up Networking dialog box, with a timer embedded on it - the timer starts to count down once the connection is established, and stops once it is disconnected. If the time runs out then the connection is broken automatically. The problem with this is that the connection is made and broken by the dialog box, and if another application tries to connect (such as IE, or the RAS monitor in the system tray), it can bypass my restrictions and connect for an unlimited time. This is a major problem because the connection will ultimately be over a satellite link where connection time costs serious money.

The way I would like to do this is to have my application listening for RAS events - i.e. when a connection is made from any source my application can start the timer and can prevent a connection if there is no time left, and when a connection is broken by any means the application should stop the timer. I cannot find any reference to such events, however, so I don't know if this is possible. Perhaps I have to listen on a lower level for action on a COM port? I'm fairly sure that the event-based approach is possible because the instant that you connect using my RAS program the button labelled 'Dial' in the Windows DUN dialog changes to 'Hang up' and when you disconnect it changes back to 'Dial', but how does it know that the connection is made or broken, and how can I trap these events?

Although it is currently written in VB I would not be averse to writing the new version in C or C++ (or Java, although I don't believe that Java will be much use here)

Do you have any ideas how to do this? Is the event-based approach possible, or alternatively is there an even better way? Any pointers in the right direction would be greatly appreciated.

Yours Sincerely,

Dave Turner