Zamnedix wrote:
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:

#!/usr/bin/python
import socket
import sys
a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
address = str(raw_input("HOST:PORT > "))

'raw_input' returns a string, so there's no need to use 'str'.

address = address.split(":")
a.connect((address[0], int(address[1])))
print "CONNECTED"
while 1:
   print a.recv(4079)
   print a.recv(4079)
   msg = str(raw_input("MSG > "))
   a.sendall(msg)
[snip]

It might be expecting the string to end with '\n' or '\r\n'.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to