February 3rd, 2005, 04:28 AM
Building a webserver (VC++/MFC)
I am trying to build a webserver. I know the basics of HTTP headers and how a client/server situation works. I know that if I have my server running (and it is working correctly), then when IE connects to 127.0.0.1, then the server replies with HTML. I cannot get my server to send HTML...or even get IE to display a different error page.
I need help on how to send HTTP headers with VC++. I have included the "OnStart()" function. My dialogue right now is stripped of nothing but this button really. When you click it, it creates a socket, listens on the socket, and accepts any connections. I think my problem actually lies in Accepting the socket, because that part seems to fail if I use:
Here is the function:
MessageBox("Error Creating Socket!");
// TODO: Add your control notification handler code here
char m_head = "HTTP/1.1 200 OK\nCache-Control:·private\nContent-Type:·text/html\nServer:·God/0.5";
char m_html = "<html>Biotch!</html>";
MessageBox("Could not create connection!");
Geek isn't just a four-letter word; it's a six-figure income.