Discussion:
How to connect with SLIME to remote SBCL?
(too old to reply)
Karol Skocik
2006-02-23 21:03:28 UTC
Permalink
Hi guys,
I have a problem with connecting to SBCL 0.98 running on our FreeBSD
server.
The server serves as firewall as well, and it looks like that SWANK
wants to open another port (besides the one on 4005) somewhere and we
dont know the where it is. Since we don't want to allow all ports by
default, and want to keep server working as firewall, how to solve
this?

I start SWANK with this :

***@saturn ~ $ cat multi-repl-sbcl
sbcl --load multi-repl-sbcl.lisp

where multi-repl-sbcl.lisp looks like this :

(load "/usr/local/cl-registry/slime/swank-loader")
(swank-loader:load-swank)
(load "/usr/local/cl-registry/slime/present")

(defun start-swank (&key (port swank::default-server-port)
(style swank:*communication-style*)
(dont-close t))
"Start the SLIME swank server, listening on PORT. Multiple
connections are allowed."
(swank:create-server :port port
:style style
:dont-close dont-close))
(start-swank)

When I start SBCL like "sbcl --load multi-repl-sbcl.lisp", SWANK is
started and listens on server according to sockstat :

***@Server$ sockstat | grep sbcl
md sbcl 61826 6 tcp4 127.0.0.1:4005 *:*

So, here is first problem :

-1- How to setup SWANK to listen on the address of the server
(192.168.0.1) instead of server's localhost address??? (we are
redirecting communication - is it problem?)

Now, I connect to SWANK. I do slime-connect RET 192.168.0.1 RET 4005
RET,
and I get this on the bottom of the Emacs :
error in process filter: connection failed: connection refused,
127.0.0.1, *lisp-output-stream*

Why is the 127.0.0.1 there?

Now, after the attempt to connect, sockstat looks like this :

md sbcl 61826 5 tcp4 127.0.0.1:4005
192.168.0.50:54812
md sbcl 61826 6 tcp4 127.0.0.1:4005 *:*
md sbcl 61826 7 tcp4 127.0.0.1:57255 *:*

so we can see that there is port 57255 on server (127.0.0.1), which is
not allowed, and that's why is probably fails (maybe.. what's that
another 4005 doing there?)

When I want to close Emacs, I see this process list :

Proc Status Buffer Tty Command
---- ------ ------ --- -------
SLIME Lisp open *cl-connection* (none) (network stream
connection to 192.168.0.1)

What to do? We would really like to use SLIME & SBCL, and connect
remotely, but how to solve this?

Thanks for any ideas,
Karol
Scott Bell
2006-02-23 21:20:25 UTC
Permalink
Karol,

SLIME binds to your private loopback interface 127.0.0.1. This is done
for security reasons, you most definitely do not want just anyone
connecting to your Lisp with full access to the system. The easiest and
safest way to accomplish a remote connection to a SWANK session is to
use an SSH tunnel to the remote machine.

Hope this helps,

- Scott Bell
Karol Skocik
2006-02-24 00:25:53 UTC
Permalink
Hi,
Thanks for reply, but how SSH tunnel will help us? The problem seems
to be there, that we don't know the number of port SWANK opens to
communicate (REPL thread on it?) with Emacs, so we cannot tunnel
something which is not known before we connect. I have changed
*loopback-interface* to 192.168.0.1, and changed 127.0.0.1 to
192.168.0.1, but it does not help either.
Karol
Tchavdar Roussanov
2006-02-25 16:48:46 UTC
Permalink
Post by Karol Skocik
Hi,
Thanks for reply, but how SSH tunnel will help us? The problem seems
to be there, that we don't know the number of port SWANK opens to
communicate (REPL thread on it?) with Emacs, so we cannot tunnel
something which is not known before we connect. I have changed
*loopback-interface* to 192.168.0.1, and changed 127.0.0.1 to
192.168.0.1, but it does not help either.
Karol
(setf swank:*use-dedicated-output-stream* nil)

Cheers

Steven E. Harris
2006-02-23 23:41:34 UTC
Permalink
Post by Karol Skocik
How to setup SWANK to listen on the address of the server
(192.168.0.1) instead of server's localhost address??? (we are
redirecting communication - is it problem?)
Look at how swank::*loopback-interface* is used in the code. It's not
an exported variable, but you could experiment with it.
Post by Karol Skocik
Now, I connect to SWANK. I do slime-connect RET 192.168.0.1 RET 4005 RET,
error in process filter: connection failed: connection refused,
127.0.0.1, *lisp-output-stream*
Try setting swank:*use-dedicated-output-stream* to nil.
--
Steven E. Harris
G***@specastro.com
2006-02-24 01:51:12 UTC
Permalink
Post by Karol Skocik
Hi guys,
I have a problem with connecting to SBCL 0.98 running on our FreeBSD
server.
The server serves as firewall as well, and it looks like that SWANK
wants to open another port (besides the one on 4005) somewhere and we
dont know the where it is. Since we don't want to allow all ports by
default, and want to keep server working as firewall, how to solve
this?
Karol,

I haven't done this myself, but here's some web links that discuss
SLIME & remote connections.

http://bc.tech.coop/blog/051227.html
http://sandbox.rulemaker.net/ngps/91
http://a1k0n.net/blah/archives/2005/11/04/T18_00_44/index.html
http://article.gmane.org/gmane.lisp.slime.devel/3422/match=remote

You can find a lot of different discussion by searching on "remote" on
www.gmane.org in group gmane.lisp.slime.devel.

Hope they help.

Glenn
Karol Skocik
2006-02-24 07:39:35 UTC
Permalink
Thanks!
I am going to check out...
Karol
Loading...