That looks way nicer than the previous code... In my collection of code snippets from this forum i had something to handle the input properly...
Also this line gave me some trouble, so i rearranged a bit Enter the command: Connected! Run proc ask(): string= stdout.write("> ") let bla = stdin.readLine() return bla proc asyncWaitFor[T] (work: FlowVar[T], sleepTime: int = 100):Future[T] {.async.} = ## waits asynchron for a FlowVar to finish while not work.isReady : await sleepAsync(sleepTime) return ^work proc main()= echo("Chat application started") var socket = newAsyncSocket() waitFor doConnect(socket, ip) stdout.writeLine("The connection has been established.") while true: let work = spawn ask() let input = waitFor asyncWaitFor(work) waitFor processCommand(input,socket) Run