Thank you Adam,
Your code is comprehensive. I will read it closely for ideas.
I seek a minimalist approach for locally run applications.
std.socket is too low level for serving webpages. It just provides
the means to talk on the network, but doesn't do any application
protocols like http.
I've written a little http server in D, but it uses linux system
calls instead of std.socket, so it only works on linux.
http://arsdnet.net/dcod
The program as such can regurgitate a web page provided these additional lines:
string webpage = "index.html";
string output = "HTTP/1.1 200 OK\r\n Content-Type: text/html;
charset=UTF-8\r\n\r
\n" ~ to!string(read(webpage) ~ "\r\n";
This does not serve a page as localhost:port/webpage.html, but
On 14-7-2011 5:48, Dr.Smith wrote:
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 bytes
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.liste