Python Forum
Aggregate multiple telnet connections - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: Aggregate multiple telnet connections (/thread-8640.html)



Aggregate multiple telnet connections - Jibeji - Mar-01-2018

Hello,
Fist of all, I am a real newbie with Python but I know some other languages. I hope I will be able to learn Python...

I have 3 devices which send their log via telnet protocol, and an appliance (kinf of telnet client) which connects via telnet to retreive the logs.
My concern is that this appliance can connect to only one remote device.

So I would like to create a script which connects to 3 (or more) different devices with telnet but also listen on telnet protocol so that the appliance will only connect to the script and retrieve all the "aggregated" logs.

Would you please point me on the right direction?

I have played a little bit with telnetlib, but I can't figure out how to parallelize multiple clients and redirect the content to one server.


RE: Aggregate multiple telnet connections - mpd - Mar-02-2018

Python provides a lot of support for concurrency: https://docs.python.org/3/library/concurrency.html

I would probably start by using Threads and a concurrent queue; each thread connects to a device and puts its log information on the concurrent queue. A different thread accepts connections from the "appliance" and pulls data from the queue and sends it to the appliance.