Running multiple virtual terminal controls simultaneously in one application

0 votes
asked Dec 28, 2016 by carnch (230 points)

I'm having a strange issue with running multiple instances of the Virtual Terminal control within a single application. I am writing an app that will connect to devices (routers, firewalls, switches, etc.) and run a script that pulls the configuration for each device and finally disconnects. The way it works is that each connection runs in a dynamically created form. The problem is when I try to run more than one connection at a time only the one that connects first runs, the others just sit there trying to connect. If I run them one at a time all of them work. It's as if all of the virtual terminal instances share a common backend and are conflicting with each other. I've tried substituting the Terminal Control for the Virtual Terminal control but have the same issue.

Can I only run one instance of Virtual Terminal at a time? Is there a way around that?

1 Answer

+1 vote
answered Dec 28, 2016 by Lukas Matyska (32,500 points)
selected Dec 28, 2016 by carnch
 
Best answer

There is no common backend for VirtualTerminal nor TerminalControl.

To test VirtualTerminal:
I bind two instances of VirtualTerminal to one Ssh object and another two instances of VirtualTerminal to one Telnet object. All four instances of VirtualTerminal are running simultaneously in four tasks without blocking each other.

To test TerminalControl:
I created a WinForm. I placed three TerminalControls on it. In Form_Load method I bind two TerminalControls to an Ssh object and one TerminalControl to Telnet object. I am able to work with all TerminalControls without blocking each other.

Moreover, I opened another form with TerminalControl when button was clicked. All terminals on all forms were working fine.

Finally, I created a form with a TerminalControl dynamically and I opened it when a button was clicked. Again, all terminals were working fine.

If you would like to see my test code, please let me know.

I think that the issue is related to the way you create or display forms. If you send me your code, I can look at it and hopefully spot something. In this case, send your project to support@rebex.net

commented Dec 28, 2016 by carnch (230 points)
Please send me your test code. I'd like to take a look at it.
commented Dec 28, 2016 by Lukas Matyska (32,500 points)
commented Dec 28, 2016 by carnch (230 points)
Thank you for the test code. That gave me the nudge I needed in the right direction.

My example was more like your "Show static form" example. I had a single static form that I was instantiating multiple times within a loop, once for each connection and the first instance of the form was causing the subsequent forms to wait since they were all running within a single thread and this was causing the SSH/telnet connections on the other forms to time out. The fix was to run each instance of the form on its own thread while making the parent form the owner of each form. Once I did that each instance ran perfectly fine without causing the other instances to freeze.
commented Dec 30, 2016 by Lukas Matyska (32,500 points)
Great, that you were able to solve the issue.
...