Android question: how to connect to swank, running on android?

Daniel Kochmański daniel at turtleware.eu
Sun Aug 20 19:47:30 UTC 2017


Did you try again (without restarting ECL on Android) to slime-connect 
to Android host? I don't remember, but I think I had such problem, but 
connecting again worked (but it may be just my imagination).

Other ideas: are you sure your slime and swank versions match?

Did you try to update slime and swank to the newest (i.e taken from 
github) versions?


On 20.08.2017 21:39, PR wrote:
> 2017-08-19 23:25 GMT+02:00, Daniel Kochmański <daniel at turtleware.eu>:
>> AFAIR I was connecting over wifi to the REPL on my Android device.
>>
>> If the port forwarding works fine - do you have some logs either from
>> emacs or running ECL process which show what's going on?
> ok, just to report the current state:
>
>   - if I run '(start-swank)' from the desktop (same sources as on
> android), it works locally
>   - PC and tablet are connected via USB
>   - both PC and tablet are in the same wlan, and can ping each other
>   - port forwarding is enabled: 'adb forward tcp:4005 tcp:4005'
>   - if I try to connect from the PC to Swank running on the tablet,
> Emacs logs these messages:
>
>
> <snip Emacs messages>
>
>    Connecting to Swank on port 4005..
>    Lisp connection closed unexpectedly: connection broken by remote peer
>
>    error in process filter: if: Lisp connection closed unexpectedly
>    error in process filter: Lisp connection closed unexpectedly
>    Error running timer `slime-process-available-input': (error
> "Selecting deleted buffer")
>
> </snip Emacs messages>
>
>
> So, still no luck...
>
> Paul
>
>
>
>
>
>
>> Daniel
>>
>>
>> On 19.08.2017 22:24, PR wrote:
>>> thanks to both of you, but it still doesn't work.
>>>
>>>   From the PC, I did:
>>>
>>>     $ adb forward tcp:4005 tcp:4005
>>>
>>> so, this part works.
>>>
>>> Daniel, I already "stole" the functions from the "ecl-android" project
>>> (prior to post my question); without them I would have been lost...
>>>
>>> So, I'll have to play around a little... Of course I will post the
>>> solution here, if I get it to work.
>>>
>>> Paul
>>>
>>>
>>> 2017-08-19 17:27 GMT+02:00, Daniel Kochmański <daniel at turtleware.eu>:
>>>> Hello,
>>>>
>>>> swank listens by default only for localhost connections (for a good
>>>> reason!). To force it to listen for connections from specific host other
>>>> than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For
>>>> instance to listen for connections from everywhere on port 4005 you
>>>> could use functions from
>>>> https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/user.lisp
>>>>
>>>> (defun start-swank ()
>>>>      (format t "Starting swank server~%")
>>>>      (mp:process-run-function
>>>>       "SLIME-listener"
>>>>       (lambda ()
>>>>         (let ((swank::*loopback-interface* "0.0.0.0"))
>>>>           (swank:create-server :port 4005
>>>>                                :dont-close t
>>>>                                ;; :style nil #|:spawn|#
>>>>                                )))))
>>>>
>>>> (defun stop-swank ()
>>>>      (format t "Stopping swank server~%")
>>>>      (swank:stop-server 4005)
>>>>      (format t ";; Swank off-line~%"))
>>>>
>>>> Note, that newest slime/swank should support :spawn communication style
>>>> just fine with ECL (my PR was merged lately). In that case it should be
>>>> enough to call create-server which won't block (note that in the example
>>>> above we create separate thread for that).
>>>>
>>>> Since ECL isn't run from CLI but as shared library, it is useful to
>>>> define implementation for implementation program (don't remeber for
>>>> sure, but I think lack of this caused some problems later)
>>>>
>>>> (defimplementation lisp-implementation-program ()
>>>>      "Return the argv[0] of the running Lisp process, or NIL."
>>>>      "org.lisp.ecl")
>>>>
>>>> Hope this helps.
>>>>
>>>> Best regards,
>>>>
>>>> Daniel
>>>>
>>>>
>>>> On 19.08.2017 16:32, PR wrote:
>>>>> Hi again,
>>>>>
>>>>> so, the progress of the new android REPL is going well, it already
>>>>> runs Quicklisp and can start swank, and right there I'm stuck now:
>>>>> How does one connect from the local computer to the android device,
>>>>> which is running the SLIME-listener?
>>>>>
>>>>> They are connected via USB, and the device is /not/ rooted.
>>>>>
>>>>> Since this is certainly of public interest, I ask here, thanks for any
>>>>> help!
>>>>> Below the link to the current APK of the REPL (you'll need android
>>>>> version >= 4.1, API >= 16):
>>>>>
>>>>> http://lights-of-holiness.eu/tmp/repl.apk
>>>>>
>>>>> After launching the app, do (there is currently no feedback of the
>>>>> progress, sorry):
>>>>>
>>>>>      (quicklisp)   ; should take less than a minute, with a fast
>>>>> internet
>>>>> connection
>>>>>      (start-swank) ; same as above (needs to byte-compile all
>>>>> 'contribs')
>>>>>
>>>>> If I run:
>>>>>
>>>>>      (mp:all-processes)
>>>>>
>>>>> it lists the running "SLIME-listener" process, so it seems to work...
>>>>>
>>>>> Thanks for any help!
>>>>>
>>>>> Paul
>>>>>
>>




More information about the ecl-devel mailing list