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 7182653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:48:54+00:00 2026-05-28T17:48:54+00:00

I have a little server.jar, which listen to GET and END command on port

  • 0

I have a little server.jar, which listen to GET and END command on port 10000.

My client code is :

package communication;

import java.io.*;
import java.net.*;

public class Client {

public static void main(String args[]) throws Exception {
    try {

            Socket socket = null;
            PrintWriter out = null;
            BufferedReader in = null;

            socket = new Socket("localhost",10000);
            System.out.println("SOCKET = " + socket);
            System.out.print(socket.getInetAddress() + "\n");
            System.out.print(socket.getInputStream() + "\n");
            System.out.println(socket.isConnected() + "\n");

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

            in = new BufferedReader(new 
                            InputStreamReader(socket.getInputStream()));

            String str = "GET";
            out.println(str);   
            String reponse = in.readLine();
            System.out.println(socket.isConnected() + "\n");
            for(int i = 0; i < 10; i++){
                    out.println(str);          // envoi d'un message
                    reponse = in.readLine();      // lecture de la reponse
                    System.out.println("Forme recue: " + reponse);
            }
            System.out.println("END");     // message de terminaison
            out.println("END") ;
            in.close();
            out.close();
            socket.close();

    }
    catch(IOException e) {
            System.out.println(e.getCause());
    }
}
}

I know this code works, because it runs on one of my computers. However, I can’t make it run on another one. Configurations on both are : Windows 7 64, JRE 6, Eclipse.

My server.jar application opens a little GUi that lets me know wether the communication is open or not, which is never the case on the computer that btw get stuck on the readLine() line.

I tried to turn off Windows firewall, antivirus… nothing worked.

Does anyone know what is going wrong here?

thanks!!

  • 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-05-28T17:48:55+00:00Added an answer on May 28, 2026 at 5:48 pm

    Im staring at the localhost string, and have a hunch that could be the problem.

    In an answer from this post, there could be something with the :: localhost that needs to be commented, and also hardcoding the localhost as 127.0.0.1 in your C:\Windows\System32\drivers\etc\hosts file.

    By hardcoding the localhost with a specific IP address, the server will listen to the same localhost as the one your client program tries to connect to.

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

Sidebar

Related Questions

I am adapting a little rmi client-server application. I have written several things :
I am writing a little application in android which would have a server part
I have a SQL Exception that occurs on a client's production server (in which
I have a little web server application which reads X bytes from a file
I am veteran server side java developer. I have little experience in client web
I write server code but have little to almost no JQ experience. I have
I'm using P4COM to communicate with our perforce server. I have written an little
I have a Java project that has both server and client packages. In addition
Suppose I have some PHP code running inside a web server, for example, running
I have set up a little server on an old XP Pro box, with

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.