If you came of age in the modern cloud era (Post-2010), Telnet is that "insecure thing" you disable on routers. But for those of us who cut our teeth on BBSes, mainframes, or early Unix hacking, —a raw, text-based window into another machine.
(defun start-tlen-server (&optional (port 2323)) "Start a Telnet-like server on PORT." (let ((listener (usocket:socket-listen "0.0.0.0" port))) (format t "~&TLEN Server listening on port ~A~%" port) (loop (let ((client-stream (usocket:socket-stream (usocket:socket-accept listener)))) (format t "~&New connection from ~A~%" client-stream) ;; Handle one client, then close (simple for demo) (handler-case (handle-client client-stream) (error (e) (format t "Error: ~A~%" e))) (close client-stream)))))
I recently spent a weekend revisiting Telnet, not as a sysadmin, but as a Lisp programmer. Why? Because stripping away TLS, JSON, and REST frameworks reveals something beautiful:
If you meant a specific library or different term, just let me know and I will rewrite the post for you. Remember Telnet?
And Lisp? Lisp is the perfect knife for cutting through that stream. Modern APIs are obsessed with structure. GraphQL schemas, Protobuf definitions, OpenAPI specs. It's powerful, but it's heavy.
That's it. 15 lines of Lisp, and you have a protocol server. You might think: "A loop that reads and writes? Python can do that."
For a Lisp REPL, this is home turf. Lisp doesn't care if you're crunching matrices, parsing XML, or listening on port 23. The code looks the same. Let's build a toy Telnet server in Common Lisp. We'll call it tlen.lisp (see what I did there?).
If you came of age in the modern cloud era (Post-2010), Telnet is that "insecure thing" you disable on routers. But for those of us who cut our teeth on BBSes, mainframes, or early Unix hacking, —a raw, text-based window into another machine.
(defun start-tlen-server (&optional (port 2323)) "Start a Telnet-like server on PORT." (let ((listener (usocket:socket-listen "0.0.0.0" port))) (format t "~&TLEN Server listening on port ~A~%" port) (loop (let ((client-stream (usocket:socket-stream (usocket:socket-accept listener)))) (format t "~&New connection from ~A~%" client-stream) ;; Handle one client, then close (simple for demo) (handler-case (handle-client client-stream) (error (e) (format t "Error: ~A~%" e))) (close client-stream))))) lisp tlen
I recently spent a weekend revisiting Telnet, not as a sysadmin, but as a Lisp programmer. Why? Because stripping away TLS, JSON, and REST frameworks reveals something beautiful: If you came of age in the modern
If you meant a specific library or different term, just let me know and I will rewrite the post for you. Remember Telnet? And Lisp
And Lisp? Lisp is the perfect knife for cutting through that stream. Modern APIs are obsessed with structure. GraphQL schemas, Protobuf definitions, OpenAPI specs. It's powerful, but it's heavy.
That's it. 15 lines of Lisp, and you have a protocol server. You might think: "A loop that reads and writes? Python can do that."
For a Lisp REPL, this is home turf. Lisp doesn't care if you're crunching matrices, parsing XML, or listening on port 23. The code looks the same. Let's build a toy Telnet server in Common Lisp. We'll call it tlen.lisp (see what I did there?).