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

  • Home
  • SEARCH
  • 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 9161379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:57:18+00:00 2026-06-17T13:57:18+00:00

{ Socket s = new Socket(xxx.xx.xx.xx,10004); BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out

  • 0
  { Socket s = new Socket("xxx.xx.xx.xx",10004);

    BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in));

    PrintWriter out = new PrintWriter(s.getOutputStream(),true);

    BufferedReader bufIn  = new BufferedReader(new InputStreamReader(s.getInputStream()));

    String line = null;     
    while((line=bufr.readLine())!=null){
         if("over".equals(line))
             break;

         out.println(line);

         String upperStr = bufIn.readLine();
         System.out.println(upperStr);
    }

    s.close();}

so does the out.println(line); mean 1. the string which was entered will appear on the screen and 2.the content will be sent to the server socket at the same time? Thanks, guys.

  • 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-17T13:57:19+00:00Added an answer on June 17, 2026 at 1:57 pm

    Your variable out is a PrintWriter, but that doesn’t mean that its something that will be printed on the screen. In this case, you gave it something that is the output stream of a socket, so it will print a line to the socket. If you want it to appear on the screen as well, you’ll have to call something like System.out.println(line) as well.

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

Sidebar

Related Questions

InetAddress host = InetAddress.getLocalHost(); Socket link = new Socket(host, Integer.parseInt(args[0])); System.out.println(before input stream); ObjectInputStream
When I declare in Java Socket s = new Socket((String)null, 12345); Does this actually
I have small test app: Socket socket = new Socket(jeck.ru, 80); PrintWriter pw =
My application freezes when connecting using System.Net.Sockets; m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_Socket.Connect(Host,
I write socket client: clientSocket = new Socket(192.168.1.102, 15780); outToServer = new DataOutputStream(clientSocket.getOutputStream()); All
When creating a Socket in Java: new Socket(host, port); The Socket constructor will try
Here is my code Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.Bind(new IPEndPoint(IPAddress.Any, 0));
If I create a socket using var socket = new UdpClient(0,AddressFamily.InterNetwork); How do I
I have a program shown below: Socket receiveSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); EndPoint
I'm using this kind of code for my TCP/IP connection: sock = new Socket(host,

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.