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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:56:00+00:00 2026-06-11T23:56:00+00:00

I want to use java Sockets to connect two Android devices on different networks.

  • 0

I want to use java Sockets to connect two Android devices on different networks. One device will act as a server and the other as a client. Which address will the server have to publish so that the client can connect to it?

java.net has the InetAddress class with the method getLocalHost() which provides an instance with localhost information (hostname, localhost address). If I run it on my machine, the address I’m given is 192.168.1.101. Is this the address the server device would have to publish in order for the client device to connect to it? I’m assuming no since it is a local address. Where, then, do I get the correct address of each device?

  • 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-11T23:56:01+00:00Added an answer on June 11, 2026 at 11:56 pm

    You can enumerate all network interfaces using NetworkInterface. You may also need to handle connectivity changes, such as switching from 3G to Wifi, etc. Generally, your device is not guaranteed to have a global IP address, so unless you only run it on your own network and you have a valid IP or have set up necessary NAT/port forwarding, etc. you may not able to connect to it.

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

Sidebar

Related Questions

I want to implement an SSL proxy in Java. I basically open two sockets
For my server coded in java I want to add a console. I connect
I want to use java key store to save keys and certificates. can anybody
i m new with netbeans platform , i want to use java class's method
I don't want to use any Java code, I just want to use <jsp:include>
i use java reflections to get methods used in a class.I also want to
I want to use curl in java. Is curl built-in with Java or I
I want to use pooled connections with Java (because it is costly to create
I want to use the pl/sql case when statement like in java or c++.
I want to use QCombobox as a the Combobox of Swing in Java .

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.