Am 05.02.2014 13:51, schrieb Kelet:

On Tue, 04 Feb 2014 11:04:32 +0100, Sönke Ludwig wrote:

This terminates fine for me on either Windows or Linux:

import vibe.core.net;

void main()
{
	auto udp = listenUDP(0);
	udp.connect("127.0.0.1", 31722);
	udp.send(cast(ubyte[])"Test");
}

Do you have anything in addition to this?

Alright, it terminates for me now. Not sure if it was a change or just me messing up here. However, since the change, if I have runEventLoop() toward the end, it gives me an error about releasing a TCP connection that is not owned. First of all, it's obviously a UDP connection (probably a typo in the source). Secondly, I guess I don't really understand the event loop in a VibeCustomMain application. It is blocking, and I oftentimes have a 'main loop' in my main function. Should I put this loop in a task, start up all of my tasks, and then runEventLoop()?

Thanks for all the help!

Can you post a stack trace of the "TCP" connection error? I think I got
that once yesterday, but didn't track it down. I think it was some
assertion that was triggered, which then bypassed releasing the connection.

Regarding the message loop, usually the vibe.d event loop is the
message loop. On windows, you can use the win32 driver instead of the
libevent one and it will also process window messages. Similarly, on
Linux, you can use vibe.core.core.createFileDescriptorEvent to listen
on the X display connection(s) for events.

If that doesn't work in a particular situation, there are basically two
generic options:

  1. Start each message loop in a separate thread
  2. Embed one message loop into the other using a polling mechanism (e.g.
    call processEvents() every X msecs)