我如何使用 ncurses 绘制 telnet 界面..?
我正在用 ruby 编写一个小泥,其中需要一些文本框和菜单项(TUI)。客户端通过telnet连接到这个应用程序,我尝试使用NCurses,但无法弄清楚它如何绘制到一个IO(这是一个套接字)...有没有可能的方法我可以开发自己的文本框和菜单小部件,我尝试查看 VT-100 ansi 终端转义码。可以写一些彩色文本,就是这样……甚至可以使用标准 telnet 应用程序创建事件驱动的接口吗?
I am writing a small mud in ruby where i need some text box and menu items (TUI). The client connect to this application through telnet, i tried using NCurses but cant figure out how it can draw to a to a IO which is a socket ... is there any possible way i could develop my own text-box and menu widgets, i have tried looking at VT-100 ansi terminal escape codes. Could write some colored text thats it ... is it even possible to make event driven interfaces with standard telnet application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编写常规 ncurses 程序/ruby 脚本并将其通过管道传输到套接字会更容易。
例如。在端口上托管 vi
打开终端并以 root 身份执行这些命令,
在端口 800 上托管 vi 应用程序
打开另一个终端
您可以用您的 ncurses 程序替换 vi。
注意:这是一个非常基本的示例,因为 nc 仅处理一个传入连接,然后终止。您将需要其他服务器程序,例如“socat”
It would be easier to write a regular ncurses program / ruby script and the pipe it to a socket.
eg. hosting vi on a port
open a terminal and execute these as root
this hosts vi application on port 800
open another terminal
You can replace vi with your ncurses program.
Note: this is very basic example because nc handles only one incoming connection and then terminates. You will need other server program like "socat"
NCurses 不理解如何写入 IO::Socket,因为它被设计为写入 STDOUT,因此唯一剩下的方法是 ANSI 转义代码也请求使用 ANSI 和 VT-100 转义代码将 telnet 从行模式切换到字符模式将帮助开发文本框小部件等...
http://ascii-table.com/ansi-escape-sequences-vt-100.php # 对于颜色
http://www.faqs.org/rfcs/np.html#TELNET #进行其他修改。
NCurses does not understand how to write to IO::Socket as it is designed to write to STDOUT so only remaining way is ANSI escape codes also requesting switching telnet from line-mode to character mode on will using ANSI and VT-100 Escape codes would help in developing the textbox widget etc ....
http://ascii-table.com/ansi-escape-sequences-vt-100.php # For color
http://www.faqs.org/rfcs/np.html#TELNET #for other modifications.