Added c# example

This commit is contained in:
Sergey Lyubka
2013-09-26 12:50:11 +01:00
parent 24e0950ca2
commit 6d2a76b609
2 changed files with 145 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
// 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();
}
}