While the following D program runs without compiler error, it seems unable to
serve a web page. Is there a better way?
import std.socket, std.string;
void main() {
Socket listener = new TcpSocket;
assert(listener.isAlive);
listener.bind(new InternetAddress(8080));
listener.listen(10);
string webpage = "index.html";
Socket currSock;
uint bytesRead;
ubyte buff[1];
while(1) {
currSock = listener.accept();
while ((bytesRead = currSock.receive(buff)) > 0) {
currSock.sendTo(webpage);
}
currSock.close();
buff.clear();
}
}