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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:20:32+00:00 2026-06-11T10:20:32+00:00

This question seems like something very obvious to ask, and yet I spent more

  • 0

This question seems like something very obvious to ask, and yet I spent more than an hour trying to find an answer.

First I host and wait for someone to connect. Then, from another instance of the application, I try to connect with a socket – for the constructor, I use InetAddress, port. The port is always right, and everything works if I use “localhost” for the address. However, if I type my IP (the one I got from Googling “what is my ip”), I get an IOException. I even sent the application to someone else, gave him my IP, and it didn’t work.

The aim of the application is to connect two computers. It’s in Java. Here is the relevant code.

Server:

ServerSocket serverSocket = new ServerSocket(port);
Socket clientSocket = serverSocket.accept();

Client:

InetAddress a = InetAddress.getByName(ip);
Socket s = new Socket(a, port);

I don’t get past that. Obviously, the values of int port and String ip are taken from text fields.

Edit: the purpose of my application is to connect two non-local computers.

  • 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-11T10:20:34+00:00Added an answer on June 11, 2026 at 10:20 am

    As mentionned by Greg Hewgill, if you are behind a NAT Device (Router, etc…) you will have to do some Port Forwarding.

    Basically, your public IP Address that you get from using “What is my IP” from google is your public IP Address, but since you are using a router with multiple computers connected to it, there is a protocol that maps multiple computers to a single public address called NAT.

    What you’ll need to do is tell your router to forward the incoming packets on a certain port to a certain computer.

    The way to do this is highlighted in this article http://www.wikihow.com/Port-Forward

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

Sidebar

Related Questions

So, I'm not sure how to ask this question, as it seems like it
This seems like a newbie question except that I've been trying to wrap my
This seems like a simple question, but has proven to be difficult to find
This seems like the simplest Git question, but I can't find ANYTHING on it.
Sorry if this question seems obvious for everyone, but I am very new to
I tried searching for this, but couldn't find much. It seems like something that's
this is might be a very basic question, but seems like it's not easy
According to this question it seems like you can do this for Methods. What
Following up to this question , it seems like Select-Object sets its input to
This seems like a repeated question but i'm not able to get my answer.

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.