@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
@OderWat
Don't mind.
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.
Sorry, Don't care about details please.:)
This error maybe don't use global variables directly in proc can correct build
it.
I was of the opinion that this forums is englisch only?
赞一下:), 谢谢了, 知道怎么不报错就行。
用callback只是想更细致的操作buf, 也只是试试先, 最近才研究nim的async和threadpool这块.
不过我还是建议你用 {.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
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
好吧, 不错! 不过我就是用的官方例子改了下, 也是这个错误. (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
这样才是正确的:
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
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
11 matches
Mail list logo