Created
April 29, 2023 12:14
-
-
Save bo-tato/2940a129d7c870423ab97a350fdaafdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-package 'sb-bsd-sockets) | |
(defparameter *socket* | |
(make-instance 'inet-socket :type :stream :protocol :tcp)) | |
(socket-connect *socket* #(127 0 0 1) 1234) | |
(sb-thread:make-thread | |
(lambda () | |
(loop for buffer = (socket-receive *socket* nil 1) | |
for c = (elt buffer 0) | |
while (char/= c #\Nul) | |
do (write-char c))) | |
:name "socket reader thread") | |
(socket-shutdown *socket* :direction :io) | |
(socket-close *socket*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment