blob: ed54be9bf04ad954b4be6aa50b9df39d5179d545 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import std.socket, std.conv;
import context;
void main(string[] args) {
if (args.length != 2) return;
auto sock = new TcpSocket();
sock.bind(new InternetAddress("127.0.0.1", to!ushort(args[1])));
sock.listen(1000);
while (true) {
auto pair = sock.accept();
auto context = new ClientContext(pair);
context.handle();
pair.shutdown(SocketShutdown.BOTH);
pair.close();
}
}
|