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

The Archive Base Latest Questions

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

Before answering, please note that this is a client side issue and not a

  • 0

Before answering, please note that this is a client side issue and not a server issue. Since I used telnet in the terminal, to connect to the server, and telnet was able to connect to the server. Now, I do not know why the connect method cannot connect I used both the localhost address and the private IP address of the server. It just blocks and it never invokes the callback method.

                client.connect(new InetSocketAddress(hostname, 1993));
                callback.onConnection(); // Never invokes!
                OutputStream writer = client.getOutputStream();
                InputStream reader = client.getInputStream();
                byte[] buffer = new byte[1024 * 1024];

P.S Am I doing something wrong. It cannot be firewall issue since telnet was able to connect to the server and I think I do not have a firewall since I am running this code in my Ubuntu machine. Both the server and client are using the TCP protocol and no exception is being thrown neither on the client and server side. Any suggestion to what might be wrong can be very useful. I can show more code like the sever code. The server is written in C++ and the client is written in Java.

Edit:

I finally was able to establish a connection. Instead of using the connect method I interally called connect by using the constructor of the socket. I do not know why connect doesnt’ work?

Here is the code modification:

            client = new Socket(hostname, port);
            callback.onConnection();
            OutputStream writer = client.getOutputStream();
            InputStream reader = client.getInputStream();
            byte[] buffer = new byte[1024 * 1024];
            reader.read(buffer);
  • 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:39:31+00:00Added an answer on June 2, 2026 at 12:39 am

    I finally was able to establish a connection. Instead of using the connect method I interally called connect by using the constructor of the socket. I do not know why connect doesnt’ work?

    Here is the code modification:

            client = new Socket(hostname, port);
            callback.onConnection();
            OutputStream writer = client.getOutputStream();
            InputStream reader = client.getInputStream();
            byte[] buffer = new byte[1024 * 1024];
            reader.read(buffer);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before answering this question, understand that I am not asking how to create my
Before answering, please understand I do NOT want you to do the work for
This is a complex question, please consider carefully before answering. Consider this situation. Two
I have never used JodaTime before, but answering this question, How to get ordinal
Before answering, it is not as easy question as you might have thought about
Before someone said that I did not read I may say that I read
Before the switch and in all apps on this passenger that run rails 2.0
Please see my first attempt at answering this . I neglected to tell the
Please read before answering. I dont want you to state the obvious for me.
Before you start flaming, I'm going to tell you that I am trying to

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.