Help with Sockets.

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jul 6 02:10:25 EDT 2009


En Sun, 05 Jul 2009 23:06:30 -0300, tanner barnes <tanner989 at hotmail.com>  
escribió:

> I am writing a program and in one section there is going to be a lobby  
> with (for testing purposes) about 4 people in it. in the lobby there are  
> two txtctrl's the first for entering your message and the second for  
> displaying the message you and the other people in the lobby type. i am  
> trying to figure out how to get all the text entrys from the users and  
> display them in the second one. For clarification and example of what i  
> want would be like yahoo or windows live messanger but for more than 2  
> people.

Like a chat room, IRC?
It's easy to do using a client-server architecture.
Make all the clients connect to a central server. Any time someone writes  
some text, the client sends it to the server (but does not display it).  
The server just receives text from any client, and sends the received  
messages to all connected clients (including the one that sent it  
originally).
Any book on socket programming will help; there are a few specific for  
Python.
You may start with the "echo" example in the Python documentation. Make  
the networking part work first, then add the wx GUI if you want.

-- 
Gabriel Genellina




More information about the Python-list mailing list