Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.44 KB | None | 0 0
  1. import asyncnet, strutils, asyncdispatch
  2.  
  3.  
  4. # var name = "lapi"
  5.  
  6.  
  7. proc writes(client: AsyncSocket) {. async .} =
  8.     var msg = readLine(stdin)
  9.     discard client.send(msg & "\c\L")
  10.  
  11.  
  12. proc main() {. async .} =
  13.     var client = newAsyncSocket()
  14.     discard client.connect("192.168.0.23", Port(6666))
  15.    
  16.     while true:
  17.         let message = await client.recvLine()
  18.         echo(message)
  19.         await writes(client)
  20.  
  21.  
  22. waitFor main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement