Twisted TCP / IP Python Connection

I have a Linode account and I am trying to telnet with a basic TCP / IP server written in Python (Twisted) installed in linode with ubuntu lts:

import os
from twisted.internet import protocol, reactor

class Echo(protocol.Protocol):
    def dataReceived(self, data):
        self.transport.write(data)

class EchoFactory(protocol.Factory):
    def buildProtocol(self, addr):
        return Echo()

port = 5000
reactor.listenTCP(port, EchoFactory(), interface="<my linode ip>")
reactor.run()

      

I thought I could just do telnet <my linode ip> 5000

and be able to send and receive messages from the server, for example when testing the application locally with telnet localhost <some port>

Could you please pass me some reference or link to help me with this? I believe I need to configure something on linode where is the server application installed? It's complicated? Thank.

+3


source to share


2 answers


I'm not familiar with linode, but I am assuming that you need to open port 5000 on your firewall to be able to connect. You can check this by trying the same telnet command from an ssh session on your linode instance. If it works from there, then it's definitely a firewall.



0


source


This code is correct. Maybe your problem is with the firewall, can you test this code through your localhost connection? telnet localhost 5000 And can you change to 0.0.0.0?



0


source







All Articles