[英]Ask a Telnet server to ignore commands
Let's say I have a working Telnet server and client; 假设我有一个正在运行的Telnet服务器和客户端; the client is my own C-programmed creation, though the server is not under my control (in my case, it is a Perle Systems IOLAN SCS48, but it could be any RFC2217-enabled Telnet device).
客户端是我自己用C编程创建的,尽管服务器不受我控制(在我的情况下,它是Perle Systems的IOLAN SCS48,但可以是任何启用RFC2217的Telnet设备)。
I want to use the devices serial tunneling features (via the RFC 2217 protocol for Telnet), but only at the start of the connection. 我想使用设备的串行隧道功能(通过用于Telnet的RFC 2217协议),但仅在连接开始时使用。 As such, I receive four negotiation requests from the server (
WILL TRANSMIT-BINARY
, DO TRANSMIT-BINARY
, WILL ECHO
, DO SUPPRESS-GO-AHEAD
, WILL SUPPRESS-GO-AHEAD
and DO COM-PORT-OPTION
; the last one being from RFC 2217), to all of which I respond, and then set baudrate, datasize, parity bit and stop bit. 这样,我从服务器收到四个协商请求(
WILL TRANSMIT-BINARY
, DO TRANSMIT-BINARY
, WILL ECHO
, DO SUPPRESS-GO-AHEAD
, WILL SUPPRESS-GO-AHEAD
和DO COM-PORT-OPTION
;最后一个是(对RFC 2217)(我对此做出了回应),然后设置波特率,数据大小,奇偶校验位和停止位。
So far so good, but now I want to re-arrange the communication so the server ignores all future commands (especiall the IAC
character 0x255
), so I can pass Hex-converted strings through the device to the receiving end (connected to the device's serial port), which gets every single byte I send (and not lose three bytes for every 0x255 that is somewhere in my string, or seven bytes where there is 0x255 0x250
( IAC SB
)). 到目前为止一切顺利,但现在我想重新安排通信,以便服务器忽略所有将来的命令(尤其是
IAC
字符0x255
),因此我可以将十六进制转换后的字符串通过设备传递给接收端(连接到设备的串行端口),它获取我发送的每个字节(并且不会丢失字符串中每0x255的三个字节,也不会丢失存在0x255 0x250
七个字节( IAC SB
))。
Alternatively, would there be a possibility to make the server pass an escaped escape char (two 0x255's in a row, which are then printed as-input) as a single 0x255? 或者,是否有可能使服务器将转义的转义字符(连续两个0x255,然后作为输入打印)作为单个0x255传递?
I do not want to close the connection to reopen it is a raw one, as my serial settings would be lost (because that's how the device's COM port redirection works, I suppose). 我不想关闭连接以重新打开它是一个原始连接,因为我的串行设置将会丢失(因为我想这是设备的COM端口重定向的工作方式)。 However, I do not need to re-establish command listening, so the connection can simply be closed and reopened as another Telnet connection if I need to reconfigure the baudrate.
但是,我不需要重新建立命令侦听,因此如果需要重新配置波特率,则可以简单地关闭该连接并将其重新打开为另一个Telnet连接。
How would I approach this? 我将如何处理?
If there's a standard IAC DO IGNORE-FURTHER-IACS, I've never heard of it. 如果有标准的IAC IGNORE-FURTHER-IACS,我从未听说过。
RFC 854 does not explain this very well, but the documented meaning of two IACs in a row is "data byte 255", so I think the server is already supposed to pass 0x255 0x255 onward as a single 0x255. RFC 854不能很好地解释这一点,但是连续两个IAC的书面含义是“数据字节255”,因此我认为服务器应该已经将0x255作为单个0x255向前传递。 Is it not doing that?
是不是这样做?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.