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:

Code:
if(!m_server.Accept(m_server2))
{
      MessageBox("Error Creating Socket!");
}
Here is the function:

Code:
void CWebserverDlg::OnStart() 
{
	// TODO: Add your control notification handler code here
	
	CString m_peer;
	UINT m_port;
	char m_head[150] = "HTTP/1.1 200 OK\nCache-Control:·private\nContent-Type:·text/html\nServer:·God/0.5";
	char m_html[50] = "<html>Biotch!</html>";

	if(!m_server.Create())
	{
		MessageBox("Could not create connection!");
	}
	else
	{
		m_server.Listen();
		m_server.Accept(m_server2);
		m_server2.Send(m_head,151);
		m_server2.Send(m_html, 51);
	}
		
}