27 Apr
2005
27 Apr
'05
7:59 p.m.
Hi, I'm trying to write a test tcp client which sends some commands to the server, I'd like the client to take the commands from stdin, and sends it to the server. The following code segment doesn't seem to send anything, is it because the while loop is actually blocking? what's the right way to accomplish this? Thanks. Z. class MyClientProtocol(basic.LineReceiver): def lineReceived(self,data): stdout.write("From Server:" + data+"\n"), def connectionMade(self): while True: cmd = raw_input("Enter command:") self.transport.write(cmd+"\r\n")