Liking cljdoc? Tell your friends :D

clj-telnet

A simple clojure telnet client

Usage

Clojars Project
CircleCI

Example

Assuming you're in a repl (lein repl)...

Import the core namespace:

(use 'clj-telnet.core)

Create a telnet object (Don't forget to close when finished)

(def telnet (get-telnet url port))

Now you can read and write from that object.

Read buffer until some-string:

(read-until telnet some-string)

Send command to telnet server:

(write telnet some-command)

Read everything from the buffer (don't use in production)

(read-all telnet)

Close the telnet connection

(kill-telnet telnet)

Use read-in-char and write-out-data hooks

(binding [*read-in-char* prn *write-out-data* prn]
  (read-until telnet some-string))

Control what happens on read exception. Eg. Swallow exception

(binding [*read-err* (constantly nil)]
  (read-a-char telnet))

Change charset (default: UTF-8)

(binding [*charset* "UTF-16"]
  (read-all telnet))

Can you improve this documentation? These fine people already did:
komcrad, cdzwm & anekos
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close