Skip to content

Instantly share code, notes, and snippets.

@erkin
Last active June 2, 2020 11:50
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 erkin/4e18e7658c02602b9ca3501b9cc5bdf8 to your computer and use it in GitHub Desktop.
Save erkin/4e18e7658c02602b9ca3501b9cc5bdf8 to your computer and use it in GitHub Desktop.
Minimal gopher client in Racket
#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