Skip to content

Crash when connecting #2

@saikyun

Description

@saikyun

I'm trying to follow along the example. I start a socket repl, and eval the following lines:

(require '[trikl.core :as t])

;; store clients so we can poke at them from the REPL
(def clients (atom []))

;; Start the server on port 1357, as an accept handler just store the client in
;; the atom.
(def stop-server (t/start-server #(swap! clients conj %) 1357))

Then when connecting using telnet localhost 1357 I get the following exception in the repl window:

Exception in server loop #error {
 :cause class java.net.Socket$SocketOutputStream cannot be cast to class java.io.FileOutputStream (java.net.Socket$SocketOutputStream and java.io.FileOutputStream are in module java.base of loader 'bootstrap')
 :via
 [{:type java.lang.ClassCastException
   :message class java.net.Socket$SocketOutputStream cannot be cast to class java.io.FileOutputStream (java.net.Socket$SocketOutputStream and java.io.FileOutputStream are in module java.base of loader 'bootstrap')
   :at [trikl.telnet$send_telnet_command invokeStatic telnet.clj 31]}]
 :trace
 [[trikl.telnet$send_telnet_command invokeStatic telnet.clj 31]
  [trikl.telnet$send_telnet_command doInvoke telnet.clj 31]
  [clojure.lang.RestFn invoke RestFn.java 2442]
  [trikl.telnet$prep_telnet invokeStatic telnet.clj 39]
  [trikl.telnet$prep_telnet invoke telnet.clj 38]
  [trikl.core$start_client invokeStatic core.clj 526]
  [trikl.core$start_client invoke core.clj 524]
  [trikl.core$make_client invokeStatic core.clj 557]
  [trikl.core$make_client doInvoke core.clj 547]
  [clojure.lang.RestFn invoke RestFn.java 442]
  [trikl.core$start_server$fn__599 invoke core.clj 625]
  [clojure.core$binding_conveyor_fn$fn__5754 invoke core.clj 2030]
  [clojure.lang.AFn call AFn.java 18]
  [java.util.concurrent.FutureTask run FutureTask.java 264]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1128]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 628]
  [java.lang.Thread run Thread.java 830]]}

I'm on MacOS. Have tried connecting using eshell and shell in emacs, and zsh terminal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions