mongoose/examples/c#/example.cs

28 lines
803 B
C#
Raw Normal View History

2013-09-26 19:50:11 +08:00
// This file is part of mongoose web server project,
// https://github.com/cesanta/mongoose
using System;
using System.Runtime.InteropServices;
public class Program {
static private int RequestHandler(MongooseConnection conn) {
return 0;
/*
conn.write("HTTP/1.1 200 OK\r\n\r\n");
conn.write("Hello from C#!\n");
conn.write("Your user-agent is: " + conn.get_header("User-Agent") + "\n");
*/
}
static void Main() {
Mongoose web_server = new Mongoose("c:\\", "8080",
new MongooseBeginRequest(RequestHandler));
Console.WriteLine("Mongoose v." + web_server.version_ + " started.");
Console.WriteLine("Press enter to exit program.");
// Serve requests until user presses "enter" on a keyboard
Console.ReadLine();
}
}