Socket MUD client script
zamnedix at gmail.com
Fri Oct 30 18:41:35 CET 2009
I'm having trouble with this script I'm writing. I want it to connect
to a MUD, which it does fine, but afterwards it displays the greeting
and login prompt, and when I type in username the loop to receive and
then send seems to stop.
Here's my code:
a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
address = str(raw_input("HOST:PORT > "))
address = address.split(":")
msg = str(raw_input("MSG > "))
Here's what happens:
$ python connect.py
HOST:PORT > lofe.org:8000
((big ascii art greeting, staff info and stuff))
Enter your character's name, or type new:
MSG > Xeythos
la la la la la la
^CTraceback (most recent call last):
File "connect.py", line 18, in ?
Also, I have to receive twice to get the whole greeting, and it comes
really slowly in two pieces.
I've looked around the internet for a good tutorial on python and
sockets but haven't really found anything. Am I using the wrong type
of socket, or what? Someone please help.
More information about the Python-list