Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send screen over the network #137

Open
xandfury opened this issue Feb 26, 2018 · 9 comments
Open

Send screen over the network #137

xandfury opened this issue Feb 26, 2018 · 9 comments

Comments

@xandfury
Copy link

xandfury commented Feb 26, 2018

Hi,

Is it possible to send the screen over to a connected telnet client? If yes, could you please provide a minimal example.
I have a simple menu -- no animations

Thanks for your time,
Abhinav

@peterbrittain
Copy link
Owner

Since you mention telnet, I suspect you're talking about a Linux environment... Assuming that's the case, you just run telnet to connect to your Linux box and then run the program inside your telnet session. That's it!

If that doesn't cover it, could you please explain your scenario in a little more detail?

@xandfury
Copy link
Author

xandfury commented Feb 26, 2018

Ah. No. That is not what I meant.

I am implementing a telnet server using [telnetsrvlib](https://github.com/ianepperson/telnetsrvlib). I am interacting with the client via sockets API.
So I won't be giving them access to my system. Also the clients won't be executing any code/script on my system. An example of something similar using urwid. (https://github.com/urwid/urwid/blob/master/examples/asyncio_socket_server.py)
^^ See Demo2

I hope this makes sense. Thank you very much for the swift reply. 💯

@peterbrittain
Copy link
Owner

OK - I understand now...

Asciimatics doesn't have anything like that built-in. The simplest way to achieve what you want is to create a psuedoterminal (a.k.a. a pty) for your telnetserver and then use that to drive a separate process running asciimatics.

In a bit more detail, you could write your whole asciimatics application as normal, prove that it works when run locally by you. You then wrap that inside your telnet server using a pty. Sample python code for using pty is available here: https://stackoverflow.com/questions/4022600/python-pty-fork-how-does-it-work

If you have to run it all inside a single process, then you'll need to create a new Screen implementation that emulates the terminal - e.g. start from the existing _CursesScreen, but rip out all references to curses and start using the terminal emulation of your choice and printing that directly to your socket stream. There might be a package that already emulates a terminal for you if you really want to try this... I'd recommend the first approach, though.

@peterbrittain
Copy link
Owner

I'm assuming this answered the question.

@xandfury
Copy link
Author

Thanks for all the help @peterbrittain Any chances you could consider this as a feature request?

@peterbrittain
Copy link
Owner

This is a pretty niche area as you are asking for a Screen implementation for (say) a vt100 terminal. This is possible, but always going to be low priority for me. I'll leave it open and see if the community wants it enough to help out.

@jabdoa2
Copy link
Contributor

jabdoa2 commented May 3, 2019

Several of our users tried this over SSH. Simply don't do it. It will easily saturate your ethernet port and render everything unresponsive. This might work over for very simple menus which almost never update but everything else will likely be problematic.

@xandfury
Copy link
Author

xandfury commented May 3, 2019

Yeah. Animation etc won’t work. Simple TUIs should. 🙂

@peterbrittain
Copy link
Owner

In theory, the text for a terminal should be way less than the graphics primitives for remote desktop services (e.g. RealVNC), which work fine up to a point (e.g. no video games, please!)...

Doesn't change the fact that I'm not planning on working on this any time soon, though. Still leaving this for someone else to do until further notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants