Hi Janosch,
I like the Book "Beginning python: From Novice to Professional", I've used it
for some time now and its excellent:
modified excerpt: To create a simple server:
from SocketServer import TCPServer, StreamRequestHandler
class Handler(StreamRequestHandler):
def handle(self):
addr = self.request.getpeername() #you could use this for
authentication, maybe?
print 'Got connection from', addr
self.wfile.write('Thank you for connecting') #return md5 then?
server = TCPServer(('', 1234), Handler)
server.serve_forever()
More info here:
http://docs.python.org/release/2.5.2/lib/module-SocketServer.html
You can easily create a server that returns an MD5 sum, with that. A
corresponding client
Hope this helps.
Daniel,
Payplus
-----Original Message-----
From: Janosch Maier [mailto:[email protected]]
Sent: Saturday, July 31, 2010 7:49 PM
To: Linux Users Group Uganda
Subject: [LUG] Server Program
Hi,
today I had an idea. For those who know Dropbox (it is a program to sync your
files between different computers and to back them up in the internet), I like
it very much, and I was thinking about doing something similar. I mainly want
the program to watch one folder and if it changes, to upload/remove/change
another folder on my own server.
For the beginning, this is what I want to do:
Client program:
* watching a particular folder and create a md5sum (already done)
* when the md5sum changes, connect to the server and get the md5sum there.
* See which files are changed (via md5sum)
* Upload them via scp (perhaps use something else later)
Server:
* Listen on a certain port
* Wait until the client connects
* Return the md5sum of the watched folder
The language I want to use is Python.
My problem now is, I have no idea how to get a program listen on a port and let
it do something, when another program connects there.
Does anybody know some good tutorials on this topic?
I mainly want to learn something new, but if the program starts doing something
(and can be used for automated backup of a folder onto an own
server) I will publish it as free software. And if somebody wants to
contribute, don’t hesitate to contact me.
Janosch
P.S. Who wants to try Dropbox (you get 2GB of free space), if you use this
link, you (and me) get 250MB extra:
https://www.dropbox.com/referrals/NTk2MTg1Mzk
--
Janosch Maier <[email protected]> -- http://phynformatik.de This E-Mais
is signed via GnuPG <http://gnupg.org/>. My public key:
0xEB21B1DE
_______________________________________________
LUG mailing list
[email protected]
http://kym.net/mailman/listinfo/lug
LUG is generously hosted by INFOCOM http://www.infocom.co.ug/
All Archives can be found at http://www.mail-archive.com/[email protected]/
The above comments and data are owned by whoever posted them (including
attachments if any). The List's Host is not responsible for them in any way.
---------------------------------------