简体   繁体   English

如何使用原始套接字在Java中完成输入的自动完成telnet

[英]How to do autocomplete telnet of input in java using raw sockets

I am using a general purpose apache commons library to do the boring networking management so the user can telnet in and start typing in commands to my java command processor. 我正在使用通用的Apache Commons库来进行无聊的网络管理,以便用户可以远程登录并开始向Java命令处理器输入命令。 Currently it does not offer stuff like autocomplete of the current token or history which i would like to add. 目前,它不提供我想添加的诸如当前令牌或历史记录的自动完成之类的功能。

I know i can watch character by character but i am unsure how to erase and reprint the current line being entered with my new "auto completed line" etc. 我知道我可以逐个字符地观看,但是我不确定如何使用新的“自动完成的行”等来擦除和重新打印当前输入的行。

Any tips in the general direction would be appreciated.. :) 一般方向的任何提示将不胜感激.. :)

terminal emulators support escape sequences . 终端仿真器支持转义序列 Those sequences can be used to delete characters on the terminal window and to position the cursor (caret). 这些序列可用于删除终端窗口上的字符并定位光标(尖号)。

Unfortunatly, there are a couple of different standards and your server needs to know the terminal clients standard in order to send the correct control bytes. 不幸的是,有几个不同的标准,并且您的服务器需要了解终端客户端标准才能发送正确的控制字节。 So either you set a standard for your application, because you always use the same terminal client or you add a command/function to set the standard from your client. 因此,您可以为应用程序设置标准,因为您始终使用相同的终端客户端,或者可以添加命令/功能来从客户端设置标准。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM