我正在尝试从命令行使用 Swank 服务器(没有特定的生产目的,只是试图理解一些事情,并考虑一些 hacky 的想法以备后用),但我无法弄清楚我可以从telnet
session 以获得任何可用的答案;例如,我如何评估 (+ 1 1)
?
A previous question告诉:
It is indeed possible to communicate with a swank server if you familiarize yourself with the swank protocol, which seems to be underdocumented (see e. g. here: https://github.com/astine/swank-client/blob/master/swank-description.markdown). However, this exposes a TCP socket over a network, which could be unsafe. Once I tried that, too, but I was not satisfied with the IPC speed.
并且该链接实际上给出了一些提示,但遗憾的是没有示例。我无法得到任何结果。
这是我尝试过的;在用
单独启动服务器之后(swank:create-server :port 4005 :dont-close t :style NIL)
我试过这样的事情:
~ $ telnet localhost:4005
00001e(swank:listener-eval (+ 1 2))
并得到以下错误信息:
" "Reader error in file #<string-input stream from \"(swan...\" 0x6045ce0640>, position 20:
Cannot find the external symbol LISTENER-EVAL in #<\"SWANK\" package>.")Connection closed by foreign host
在那种情况下,我应该输入的字符串是什么?
最佳答案
我成功完成了这项工作:
00003e(:emacs-rex (swank:interactive-eval "(+ 1 2)") "cl-user" t 8)
请注意第一个是 :emacs-rex
关键字,以及要评估的形式是如何在字符串中的。 8 在这里只是一个任意值。回复首先以 00A1C8(:indentation-update ...)
开头,然后是:
000031(:return (:ok "=> 3 (2 bits, #x3, #o3, #b11)") 8)
关于lisp - 如何使用 telnet 在低级别与 Swank 服务器进行交互?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57230206/