Sign up ×  I am trying to write a simple Java program using
ServerSockets that will send some HTML code to the browser. Here
is my code:         ServerSocket serverSocket = null;        try
{              serverSocket = new ServerSocket(55555);
} catch (IOException e)               System.err.println("Could
not listen on port: 55555.");         Socket clientSocket =
null;         try {             clientSocket =
serverSocket.accept();              if(clientSocket != null)
} catch (IOException e) {
System.err.println("Accept failed.");       PrintWriter out =
new PrintWriter(clientSocket.getOutputStream());
out.println("HTTP/1.1 200 OK");     out.println("Content-Type:
text/html");     out.println("<p> Hello world </p>");    I then
go to localhost:55555 in my browser and nothing displays. I know
the connection is working because the program outputs
"Connected" as checked in the if statement. I have also tried
outputting the data from the inputStream and tha