Best method for an NT service and python to interact?

C

Charlie Orford

Hello all,
I have been asked to develop a python client that can talk to an NT service
(coded in C). Does anyone have any advice for the best way in which to go
about this task?

The NT service monitors file access. When a file of a specific type is
accessed I need to inform the python client.

Would it be better for the NT service to message the python client or would
it make more sense for the python client to poll the NT service at set
intervals (every 1000ms for example)?

Does anyone know of any online tutorials or examples that might point me in
the right direction?

TIA,
 
P

Peter Hansen

Charlie said:
I have been asked to develop a python client that can talk to an NT service
(coded in C). Does anyone have any advice for the best way in which to go
about this task?

The NT service monitors file access. When a file of a specific type is
accessed I need to inform the python client.

Would it be better for the NT service to message the python client or would
it make more sense for the python client to poll the NT service at set
intervals (every 1000ms for example)?

My first thought would be to send a UDP packet to localhost from the
NT service whenever the event of interest happens. That's assuming
that it's meaningful to the service that this is happening... if the
service is more generic, maybe send UDP whenever any file is accessed.

The client, when running, simply listens for those packets on a
predetermined port. If you aren't doing the file-type filtering in
the service, the client does it and the NT service can stay very
simple and generic which, since it's C code, is probably best.

-Peter
 
C

Charlie Orford

On Thu, 20 Nov 2003 21:45:14 -0500, Peter Hansen <[email protected]> fought
his way into comp.lang.python, paused briefly and let forth upon the
unsuspecting patrons the following literary masterpiece:

My first thought would be to send a UDP packet to localhost from the
NT service whenever the event of interest happens. That's assuming
that it's meaningful to the service that this is happening... if the
service is more generic, maybe send UDP whenever any file is accessed.

The client, when running, simply listens for those packets on a
predetermined port. If you aren't doing the file-type filtering in
the service, the client does it and the NT service can stay very
simple and generic which, since it's C code, is probably best.

-Peter

Thanks Peter. I am so clowded with Win32 programming that all I think about
is window messaging. Setting up a simple UDP server is a great idea and I
think I will go down this route.

Many Thanks,
 
B

Brad Clements

_
Thanks Peter. I am so clowded with Win32 programming that all I think about
is window messaging. Setting up a simple UDP server is a great idea and I
think I will go down this route.

Don't forget to consider the security ramifications of such a simple
approach.
 
P

Peter Hansen

Brad said:
_


Don't forget to consider the security ramifications of such a simple
approach.

I'll put it another way: make sure that your server is bound to
('127.0.0.1', port) instead of ('' , port) and there should be
relatively few issues with security.

-Peter
 
C

Charlie Orford

I'll put it another way: make sure that your server is bound to
('127.0.0.1', port) instead of ('' , port) and there should be
relatively few issues with security.

-Peter

Worry not guys - i may be a python newbie but i am no stranger to the
realities of coding a secure solution :eek:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top