Skip to content

Instantly share code, notes, and snippets.

@jmercouris
Created February 21, 2018 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmercouris/d2bfc9e7e9ddc10a396537045c8eacd3 to your computer and use it in GitHub Desktop.
Save jmercouris/d2bfc9e7e9ddc10a396537045c8eacd3 to your computer and use it in GitHub Desktop.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SERVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CL-USER> (ql:quickload :usocket)
To load "usocket":
Load 1 ASDF system:
usocket
; Loading "usocket"
(:USOCKET)
CL-USER> (defvar *server* (usocket:socket-listen "127.0.0.1" 8080))
*SERVER*
CL-USER> (defvar *client-1-connection* (usocket:socket-accept (usocket:wait-for-input *server*)))
*CLIENT-1-CONNECTION*
CL-USER> (read-line (usocket:socket-stream *client-1-connection*))
""
NIL
CL-USER> (read-line (usocket:socket-stream *client-1-connection*))
"\"hello world\" "
NIL
CL-USER>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CLIENT in a NEW REPL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>ccl
Welcome to Clozure Common Lisp Version 1.11-r16635 (DarwinX8664)!
CCL is developed and maintained by Clozure Associates. For more information
about CCL visit http://ccl.clozure.com. To enquire about Clozure's Common Lisp
consulting services e-mail info@clozure.com or visit http://www.clozure.com.
? (ql:quickload :usocket)
To load "usocket":
Load 1 ASDF system:
usocket
; Loading "usocket"
(:USOCKET)
? (defvar *client-1* (usocket:socket-connect "127.0.0.1" 8080))
*CLIENT-1*
? (print "hello world" (usocket:socket-stream *client-1*))
"hello world"
? (finish-output (usocket:socket-stream *client-1*))
NIL
? (print "hello world" (usocket:socket-stream *client-1*))
"hello world"
? (finish-output (usocket:socket-stream *client-1*))
NIL
?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment