Instant Messenger
John Hunter
jdhunter at ace.bsd.uchicago.edu
Tue Jul 30 10:26:29 EDT 2002
>>>>> "Chris" == Chris <chrisc894 at hotmail.com> writes:
Chris> My biggest problem is storing the sockets that recv() the
Chris> username and password, for now.
What about a dictionary? s1,s2,sn are the socket connections
m = {}
m['user1'] = s1
m['user2'] = s2
m['user3'] = s3
If you want to share this dictionary across modules and or threads,
you could use a Borg
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
And see the previous thread 'Newbie: How to touch "global" variables'
Also, you may want to look at *Python Web Programming* by Steve Holden
and David Beazley, which has bountiful examples of all kinds of
client/server programming in python. The source code is available for
a free download.
John Hunter
More information about the Python-list
mailing list