Hi all
I'm new to twisted and also have not a lot of Python experience.
My problem boils down to following situation:
I have a server and a client over TCP, once the client is connected to
the server,
the server periodically pings the client in order to check if it is
still alive.
The client sends a response/pong back to each ping.
These messages are printed to stdout. The two consoles would then look like:
[connected]
ping
pong
...2 seconds ...
ping
pong
...2 seconds ...
ping
pong
...
Now the user should be able to write commands in the command line, which
get's
sent to the server, without interrupting the pings. But in my case,
while writing on the console the output stops.
The server will send a ping, but the client does not seem to receive the
ping, since I don't get a pong on the server.
What happens at the moment I type something in the command line?
What I want, is writing stuff in the console, without interrupting the
ping mechanism.
(The pings and pongs in my case should continue to be sent while typing
stuff in the console)
That's how I use StandardIO:
class CommandLine(protocol.Protocol):
def __init__(self, protocol):
self.protocol = protocol
def dataReceived(self, data):
print('INPUT: %s' % (data)
class Client(protocol.DatagramProtocol):
def __init__(self):
# initialize command line connector
commandLine = CommandLine(self)
# connect member to command line output
self.output = stdio.StandardIO(commandLine)
Cheers