Reputation: 27
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 agent> and then I can write TL1 commands and configure the device.
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.
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 :)
Many thanks
My client code is:
#!/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
Upvotes: 0
Views: 3219