Last active
June 2, 2020 11:50
-
-
Save erkin/4e18e7658c02602b9ca3501b9cc5bdf8 to your computer and use it in GitHub Desktop.
Minimal gopher client in Racket
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
#lang racket | |
(define (gopher host (port "70") (path "/")) | |
(define-values (in out) (tcp-connect host (string->number port))) | |
(display (string-append path "\r\n") out) | |
(flush-output out) | |
(for-each displayln (port->lines in #:line-mode 'return-linefeed)) | |
(close-output-port out)) | |
(module+ main | |
(command-line | |
#:args args | |
(apply gopher args))) | |
;; Example use: % racket gopher.rkt gopher.erkin.party 70 /files/keeb.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment