[slime-devel] Problems with slime using sbcl on winXP (emacsW32)

Thomas Karolski thomas.karolski at googlemail.com
Sat Dec 6 16:11:50 UTC 2008


Helmut Eller schrieb:
> For example with:
>
> (read-char-no-hang
>  (let ((socket (make-instance 'sb-bsd-sockets:inet-socket
> 			      :type :stream :protocol :tcp)))
>    (setf (sb-bsd-sockets:sockopt-reuse-address socket) t)
>    (sb-bsd-sockets:socket-bind socket #(0 0 0 0) 5000)
>    (sb-bsd-sockets:socket-listen socket 5)
>    (unwind-protect
> 	(sb-bsd-sockets:socket-make-stream 
> 	 (sb-bsd-sockets:socket-accept socket)
> 	 :output t :input t :element-type 'character)
>      (sb-bsd-sockets:socket-close socket))))
>
> This creates a socket, waits for someone to connect, and calls
> read-char-no-hang on the new stream.
> Start this in SBCL and execute  "telnet localhost 5000"
> in a shell.  read-char-no-hang should return nil as soon
> as the telnet client connects.  
>
> If it just waits, then you can type something into the telnet window and
> the first char should appear on the SBCL side.  In this case
> read-char-no-hang doesn't work properly, it works like the ordinary
> read-char.
>   
You're right, it does not return nil as soon as someone connects. It 
does however return the first char as soon as I type something into the 
first window.
> The best solution would be to fix HANDLE-LISTEN, but I don't know how to
> do that.
>
> As a workaround you can probably replace
>     (wait-for-event `(:sldb-return ,(1+ level)) t) ; clean event-queue
> in sldb-loop with:
>     (poll-for-event `(:sldb-return ,(1+ level))
That actually solved the problem!
Now given that the problem seems to be with sbcl's HANDLE-LISTEN, I 
guess I'll check out their mailing list.

Many thanks there,
Thomas K.




More information about the slime-devel mailing list