Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:21:37+00:00 2026-06-06T17:21:37+00:00

I open a server socket at localhost’s port e.g 11111, and I also include

  • 0

I open a server socket at localhost’s port e.g 11111, and I also include printstream for stream data which i would want to output as neat as expected like this

PrintStream ps=new PrintStream(socket.getOutputStream(),false);
ps.println("<h1>Hello, it works!</h1>");

I am looking forward to seeing the output as Hello, it works!
but it becomes like this <h1>Hello, it works!</h1>

Update
I am not working with serlet or jsp, this simply is a webserver I would like to display a welcome message once the user visit the http://localhost:111111

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:21:39+00:00Added an answer on June 6, 2026 at 5:21 pm

    If you are trying to create a simple web server then you need to return a valid HTTP response that contain status code and content-type at the very least:

    PrintStream ps=new PrintStream(sock.getOutputStream(), false);
    ps.println("HTTP/1.1 200 OK");
    ps.println("Content-Type: text/html\n");
    ps.println("<h1>Hello, it works!</h1>");
    

    You can find more details about what HTTP response look like here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Port 6379 is open on the server, and I can successfully run telnet localhost
I want to write a simple server socket in Ruby, which, when a client
What are some open source client-server projects which might be best to look at
I used nmap to check which ports are open on my server it showed
We need to open a word document which is located on a server on
I have a little server.jar, which listen to GET and END command on port
If I want to open a TCP socket between 2 processes on the same
So, I pass data in xml via socket. When I have run server side,
I need an applet to open a socket and communicate with a server listening
My program consists of 2 parts - A server socket (sits on port 3490)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.