Using win32api.GetTickCount() over the network

Dave Brueck dave at
Wed Mar 5 21:37:42 CET 2003

On Wed, 5 Mar 2003, Donovan Hide wrote:

>     is there a way to connect to a remote machine and use
> win32api.GetTickCount() call to measure how long a machine has been up, in a
> smilar way to the MS utility uptime.exe. Also does anyone know how to
> control services and processes on remote machines without using other .exe
> utilities such as those from sysinternals.
>     I am writing a wxPython utility to monitor and control a 3d renderfarm
> and your assistance would be gratefully received.

Hi Donovan,

Probably the easiest and most flexible thing to do is run a custom Python
"listener" on each machine in the render farm. Here's some untested code
to illustrate:

On the listener size:


import SocketServer, pickle

class Handler(SocketServe.BaseRequestHandler):
  def handle(self):
    cmd = self.request.recv(1)
    if cmd == CMD_GET_TICKS:

addr = ('', 5000) # Listen on this address
server = SocketServer.ThreadingTCPServer(addr, Handler)

On the server side (your wxPython monitoring app):

import socket, cPickle

def GetTickCount(addr):
  s = socket(AF_INET, SOCK_STREAM)
  data = ''
  while 1:
    more = s.recv(1024)
    if not more: break
    data += more
  return cPickle.loads(data)

You can of course get much fancier by adding additional commands (kill the
render process, restart the render process, check free disk space, check
number of frames done, etc.) as well as adding the ability to send
parameters as part of the commands to the render nodes.


More information about the Python-list mailing list