[Tutor] sockets
János Juhász
janos.juhasz at VELUX.com
Fri May 5 08:23:00 CEST 2006
Hi Matt,
the traceroute can be done from the client side or eigther from the server
side.
The two ones should give the same result with reverse order.
In this case you can do the tracerouting from the server side when the
client ask it.
I am just thinking about a simple finger deamon, that can do the job for
you.
You can ask the deamon, with a simple finger request.
Finger.exe is part of th MS system so
c:\>finger %username%@myserver.com
seems to be enough in the login process.
This is the simplest fingerdeamon:
import SocketServer, os, string
class FingerHandler(SocketServer.StreamRequestHandler):
def handle(self):
username = self.rfile.readline(512)
username = string.strip(username)
# Just do your job here
# Do the traceroute, and save the result
if __name__ == '__main__':
server = SocketServer.TCPServer( ('', 79), FingerHandler)
server.serve_forever()
Matt wrote ---
Date: Thu, 04 May 2006 09:23:38 -0700
From: Matt Richardson <marichar at csusb.edu>
Subject: Re: [Tutor] sockets
To: Tutor at python.org
Message-ID: <445A2A8A.40308 at csusb.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I need to send some data, 2 strings and a list, to a remote computer.
After thinking about it some last night, it wouldn't be hard to just
send it all as a string and then parse it on the receiving end.
I'm writing a program for work (and for a class project, so no answers!)
that will provide some info on the network location of a laptop. The
client will gather IP address, MAC address, and a traceroute dump (the
list mentioned above), then send this off to a super simple server that
receives the data and puts it in a database. We've had a few laptops
'disappear' either through theft or people taking them home to do 'work
from home' or whatever. Makes annual inventory a huge pain.
Matt
Yours sincerely,
______________________________
Janos Juhasz
More information about the Tutor
mailing list