It works when put it into a proc. But it does not do what I expect from it. It
only reads 10 chars and in the next turn it reads nothing anymore.
import asyncnet, asyncdispatch
import asyncnet, asyncdispatch
proc main() =
var sock = newAsyncSocket()
proc onConnect() =
echo("Connected in future!")
asyncCheck sock.send("GET /\r\l\r\l")
for i in 0 .. 50:
var recvF = recv(sock, 10)
recvF.callback =
proc (future: Future[string]) =
echo("Read ", future.read.len, ": ", future.read.repr)
var ft = connect(sock, "nim-lang.org", Port(80))
ft.callback = onConnect
runForever()
main()
- Favorable Rakhi for Bhaiya and Bhabhi on Rakhi Celebration anjalietrade
- Can't build asyncnet example on macosx Angluca
- Re: Can't build asyncnet example on macosx OderWat
- Re: Can't build asyncnet example on macosx _tulayang
- Re: Can't build asyncnet example on macosx Angluca
- Re: Can't build asyncnet example on mac... _tulayang
- Re: Can't build asyncnet example on... _tulayang
- Re: Can't build asyncnet exampl... Angluca
- Re: Can't build asyncnet exampl... OderWat
- Re: Can't build asyncnet exampl... Angluca
- Re: Can't build asyncnet exampl... dom96
- Re: Can't build asyncnet exampl... _tulayang
- Re: Can't build asyncnet exampl... qqtop
