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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:44:08+00:00 2026-06-02T00:44:08+00:00

I need to build an application which can receive data from over a network

  • 0

I need to build an application which can receive data from over a network and use this data to do some unrelevant things with.

Here’s a piece of code to make clear what I’m doing.

On the server side:

static Socket client = null;
static ServerSocket ss = null;

if (ss != null) {
                ss.close();
            }
            ss = new ServerSocket(5513);
            isrunning = true;
            System.out.println("Waiting for client...");
            client = ss.accept();
            System.out.println("Client accepted.");
            BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));

And the client side:

Socket client = null;
PrintWriter out = null;
                    try {                            
                        client = new Socket("hostname", 5513);
                        out = new PrintWriter(client.getOutputStream(), true);
    }

Please note that this is just a piece of the code. There are no errors in the code.

After running the server-sided piece of code, it correctly waits for the client to connect.

Now here comes the problem. As soon as I try to connect from the client side, I’m getting a “connection refused”-error.

HOWEVER, I found something on the internet whoch told me to try telnetting from the client side. For example, let the server-sided IP be 192.168.1.1. So, after using this command:

    telnet 192.168.1.1 5513

I actually get a connection with the server. The command will launch an empty screen, and everything I manually type in the command line will be sent to the server-side after pressing enter (checked with debugging).

So, I can manually connect to the server-side and send some data, but my code refuses to connect.

Anyone who knows what I am doing wrong?

  • 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-02T00:44:10+00:00Added an answer on June 2, 2026 at 12:44 am

    Is this the code you’re actually using?

    client = new Socket("hostname", 5513);
    

    Try changing it to:

    client = new Socket("192.168.1.1", 5513);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a simple web-interface application that can send/receive chat messages to/from
I'm currently writing an iPhone application which gets some data from the user and
I am trying to build an application which the user can use to draw
I need to build an application which will run on OS X, polling for
I'm trying to build a Windows Phone 7.1 application in which I need to
I need to build an application that accepts user input data (such as name,
I need to build Android application using Java which is able to send request
I am looking for a way by which I can automate my application build
We have a c++ application which I recently ported from Linux/gcc to build on
Hi I need to build an ruby on rails application which will call every

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.