Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web server and IE

Status
Not open for further replies.

JontyMC

Programmer
Nov 26, 2001
1,276
GB
I'm trying to make a web server. I connect to the the web server using IE, with a html page that has a form, and just output whatever IE sends to the command prompt. At the moment all I can get out is the http header. What I really want to do is get the form information back, then send a new page to the browser based on that info. This is the thread code that reads what IE sends and prints it out to the command prompt, then sends back a new page to the browser.

PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine;
String HTTPResponseHeader = "HTTP/1.1 200 OK\nContent-Type: text/html\nContent-Length: ";
String htmlResponseMessage = "<html><form action=\" method=\"post\" enctype=\"text/plain\"><p><input type =\"submit\" value =\"Submit!\" /></p></form></html>";

while ((inputLine = in.readLine()).hashCode() != 0)
{
System.out.println(inputLine);
}

out.println(HTTPResponseHeader+htmlResponseMessage.length()+"\n\n"+htmlResponseMessage);
 
Warning, this is a cross-post with the Java(Sun) forum.

JontyMC - please do not crosspost in the future.

--------------------------------------------------
Free Database Connection Pooling Software
 
sorry, wasnt quite sure which forum to post in. Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top