title: Python telnet client for a TL1 agent
body: <p>I have a fiber optic device which could be controlled and managed by TL1 protocol. That is, I get connected to the device like x:x:x:x 3083. Now upon connection I get a prompt like <strong><em>agent></em></strong> 
  and then I can write TL1 commands and configure the device. </p>
  
  <p>Now what I want to do is write a Python client to get connected to this TL1 agent on the device. This client has to get messages from another application and translate thenm to TL1 commands and put it in TL1 agent on the device. so in essence I want to write a Python translator that does this job but for start I want to write the part that it gets connected to the TL1 agent and then I could send TL1 commands.</p>
  
  <p>I have written a simple tcp client for it, but when I run it I see some gibberish characters on the console which I think is because of different character format. Has some done something similar to this or could guide me where to look at it. I am a newbie in programming though :)</p>
  
  <p>Many thanks</p>
  
  <p>My client code is:</p>
  
  <pre><code>#!/usr/bin/python
  
  import sys
  from socket import *
  serverHost = 'localhost'
  serverPort = 3083     
  
  s = socket(AF_INET, SOCK_STREAM)    # create a TCP socket
  s.connect((serverHost, serverPort)) # connect to server on the port
  
  data = s.recv(1024)                 # receive up to 1K bytes
  print data
  </code></pre>