Chat server: Difference between revisions

Content added Content deleted
m (whitespace/cleanup)
Line 1: Line 1:
{{task|Networking and Web Interaction}}
{{task|Networking and Web Interaction}}


Write a server for a minimal text based chat. People should be able to connect
Write a server for a minimal text based chat. People should be able to connect via ‘telnet’, sign on with a nickname, and type messages which will then be seen by all other connected users. Arrivals and departures of chat members should generate appropriate notification messages.
via 'telnet', sign on with a nickname, and type messages which will then be seen
by all other connected users. Arrivals and departures of chat members should
generate appropriate notification messages.


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==
Line 68: Line 65:


=={{header|Python}}==
=={{header|Python}}==
<lang python>
<lang python>#!/usr/bin/env python
#!/usr/bin/env python


import socket
import socket
import thread
import thread
import time
import time



HOST = ""
HOST = ""
PORT = 4004
PORT = 4004



def accept(conn):
def accept(conn):
Line 148: Line 142:
time.sleep(.1)
time.sleep(.1)
except (SystemExit, KeyboardInterrupt):
except (SystemExit, KeyboardInterrupt):
break
break</lang>
</lang>


=={{header|Tcl}}==
=={{header|Tcl}}==