title: Having trouble with Python's telnetlib module
body: <p>I have a basic chat server which I can easily connect to with telnet. I simply enter the host and port and, without any further authentication, can begin entering commands that the server can interpret. In an effort to simulate user traffic, I would like to create a script that will open telnet, connect to the server, and immediately begin sending commands to the server. I initially attempted to do this with batch scripts, but after encountering too many road blocks I have decided to use Python's telnetlib module. This is what the script looks like now</p>
  
  <pre><code>import telnetlib
  myTel = telnetlib.Telnet('XXX.XXX.XXX.XXX', XXXX)
  myTel.write('login')
  myTel.write('move room')
  myTel.write('say message')
  myTel.write('exit')
  myTel.write('logout')
  </code></pre>
  
  <p>Its really that simple and the script runs with no errors. However, if I've already manually logged into the server on another telnet session, I fail to see the script entering the main room or sending a chat message which leads me to believe that something is going wrong. If I manually start two telnet sessions I can easily send and receive messages between the sessions, so I would think that a manual telnet session should be receiving the messages from the session started by the script.</p>
  
  <p>Any ideas?</p>