Re: Can't build asyncnet example on macosx

2016-08-15 Thread qqtop
@dom96 I would vote against sub-forums for different languages and rather suggest to anyone to use one of the translator plugins in modern browsers like: [https://addons.mozilla.org/id/firefox/addon/s3google-translator](https://addons.mozilla.org/id/firefox/addon/s3google-translator)/ or others

Re: Can't build asyncnet example on macosx

2016-08-15 Thread _tulayang
@OderWat Don't mind.

Re: Can't build asyncnet example on macosx

2016-08-14 Thread dom96
Personally I think that whatever users can use to communicate most easily is fine. We do need to improve this forum to contain sub-forums for different languages though IMO.

Re: Can't build asyncnet example on macosx

2016-08-14 Thread Angluca
Sorry, Don't care about details please.:) This error maybe don't use global variables directly in proc can correct build it.

Re: Can't build asyncnet example on macosx

2016-08-14 Thread OderWat
I was of the opinion that this forums is englisch only?

Re: Can't build asyncnet example on macosx

2016-08-14 Thread Angluca
赞一下:), 谢谢了, 知道怎么不报错就行。 用callback只是想更细致的操作buf, 也只是试试先, 最近才研究nim的async和threadpool这块.

Re: Can't build asyncnet example on macosx

2016-08-14 Thread _tulayang
不过我还是建议你用 {.async.} , 省不少事情,性能其实损失不了多少: import asyncnet, asyncdispatch proc recvAll(sock: AsyncSocket) {.async.} = for i in 0 .. 50: var ret = await recv(sock, 10) echo("Read ", ret.len, ": ", ret.repr) proc main() {.async.} = var sock = n

Re: Can't build asyncnet example on macosx

2016-08-14 Thread _tulayang
OO! 我加了个 {.gcsafe.} 可以通过了: import asyncnet, asyncdispatch var sock = newAsyncSocket() var f = connect(sock, "irc.freenode.net", Port(6667)) f.callback = proc (future: Future[void]) {.gcsafe.} = echo("Connected in future!") echo repr sock

Re: Can't build asyncnet example on macosx

2016-08-14 Thread Angluca
好吧, 不错! 不过我就是用的官方例子改了下, 也是这个错误. (asyncnet.nim 最下面) var sock = newAsyncSocket() var f = connect(sock, "irc.freenode.net", Port(6667)) f.callback = proc (future: Future[void]) = echo("Connected in future!") for i in 0 .. 50: var recvF = recv(sock

Re: Can't build asyncnet example on macosx

2016-08-13 Thread _tulayang
这样才是正确的: import asyncnet, asyncdispatch var sock = newAsyncSocket() proc onConnect(sock: AsyncSocket, host: string, port: Port) = var ft = connect(sock, "127.0.0.1", Port(12345)) ft.callback = proc (future: Future[void]) = echo("Connected in futur

Re: Can't build asyncnet example on macosx

2016-08-13 Thread OderWat
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() pr