I am coding a HTTP Server, but when I create the header and send it.
It returns: The connection to 127.0.0.1 was interrupted.
My code to make the header is:
string header = "\r\n";
header += "HTTP/1.1 200 OK\r\n";
header += "Content-Type: text/html\r\n";
header += "\r\n";
header += "<html><head><title>Test</title></head><body>Testing</body></html>";
You're starting with a line break - you shouldn't. Basically, change this:
string header = "\r\n";
header += "HTTP/1.1 200 OK\r\n";
to
string header = "HTTP/1.1 200 OK\r\n";
See more on this question at Stackoverflow