vibe-core/tests/vibe.core.net.1441/source/app.d

27 lines
366 B
D
Raw Normal View History

import vibe.core.core;
import vibe.core.net;
import core.time : msecs;
2016-06-18 06:19:06 +00:00
void main()
{
import vibe.core.log;
bool done = false;
listenTCP(11375,(conn){
conn.write("foo");
conn.close();
done = true;
});
runTask({
auto conn = connectTCP("127.0.0.1", 11375);
conn.close();
sleep(50.msecs);
assert(done);
exitEventLoop();
});
2016-06-18 06:19:06 +00:00
runEventLoop();
}