Hi All,
I am trying to make the httpserver sample into a non-gui app.
What else is needed, please ?
class HTTPApplication : Application
{
bool Init()
{
httpServer.Start();
return true;
}
bool Cycle(bool idle)
{
bool result = true;
HTTPClient client, next;
for(client = (HTTPClient)httpServer.firstClient; client; client = next)
{
next = (HTTPClient)client.next;
if(client.f)
{
#define PACKETSIZE 65536
static byte buffer[PACKETSIZE];
int read = client.f.Read(buffer, 1, PACKETSIZE);
if(read)
client.Send(buffer, read);
if(client.f.Eof())
{
delete client.f;
if(client.close)
client.Disconnect(0);
}
result = true;
}
}
return result;
}
}
HTTPServer httpServer { port = 8080 };
//Window serverWindow { size = Size { 320, 200 }, text = "ECERE HTTP Server", hasMinimize = true, hasClose = true };