On Mon, 03 Feb 2014 17:03:59 GMT, Kelet wrote:
My UDPConnection can
recv
fine in main, but put inside of a task and it cannot. This behavior is replicated for me in the udp example. All I get is "Sending packet..." and no receiving messages.
To clarify, changing the udp example to:
import vibe.appmain;
import vibe.core.core;
import vibe.core.log;
import vibe.core.net;
import core.time;
shared static this()
{
runTask({
auto udp_sender = listenUDP(0);
udp_sender.connect("127.0.0.1", 1234);
while (true) {
sleep(dur!"msecs"(500));
logInfo("Sending packet...");
udp_sender.send(cast(ubyte[])"Hello, World!");
}
});
auto udp_listener = listenUDP(1234);
while (true) {
auto pack = udp_listener.recv();
logInfo("Got packet: %s", cast(string)pack);
}
}
works, whereas the default never receives.
I'm thinking this might be related to when I try to run exitEventLoop()
at the end which yields
core.exception.AssertError@vibe.core.core(119): Assertion failure
Line 119 is
assert(s_eventLoopRunning || shutdown_all_threads);
Which means that the event loop isn't running I think. However, with VibeDefaultMain as in the example, it should be - right? I'm using vibe.d 0.7.19-beta.2 although I've tried many others. Using DMD v2.064.