Writing a TCP/IP chat server

Chris Liechti cliechti at gmx.net
Thu Apr 10 16:16:25 EDT 2003


Ian Partridge <iop199 at ecs.soton.ac.uk> wrote in
news:Pine.LNX.4.44.0304101906590.8243-100000 at servalan.ecs.soton.ac.uk: 

> Hi,
> 
> I am trying to write a chat server, which users will telnet to in
> order to interact with each other.
> 
> What is the best way to do this?
> 
> I have searched the web and found three different approaches:
> 
> 1. Use the socket libraries and select to multiplex between the 
> connections.
> 
> 2. Use the SocketServer module (although I can't find a decent
> tutorial on how to use this module)
> 
> 3. Use the asyncore module (I only found one example doing this, and I
> couldn't understand it).

 4. use twisted  http://twistedmatrix.com/
where you can:
4a. wirite your own protocol with a few lines of code
or
4b. use whats already in the libraries

5. use an existing server, e.g. there are different IRC servers.
there is no reason to reinvent the wheel unless ouy do it for education ;-)

> What's the the simplest way to approach the problem?

5. is simplest, for fun 4. (and 1. if you want to port it to C for some 
reason, but trust me, there isn't one to do so ;-)

chris
 
> Any tips gratefully received.
> 
> TIA,
> Ian
> 
> 



-- 
Chris <cliechti at gmx.net>





More information about the Python-list mailing list