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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:33:00+00:00 2026-06-06T12:33:00+00:00

I have Android client app that communicates with server using Socket . On my

  • 0

I have Android client app that communicates with server using Socket.

On my development machine, SocketServer (server is also written in Java) is listening at 127.0.1.1 at port 8666. I also have added Internet access permissions in App manifest of Android app.

But when I attempt to instantiate Socket object using client = new Socket("127.0.1.1",8666), it throws IOException with connection refused message (also tried using localhost instead of manually giving IP address, but it doesn’t work as well). While I can easily connect to server from simple console Java program.

What could be wrong here?

Update

My question in some ways relates to this. I AM attempting to access a server running in the machine same in which emulator is running.

Note: I know its not recommended to perform network IOs in any Activity class, and I’m not doing that way either, above code is just a problem simplified to understand.

  • 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-06T12:33:01+00:00Added an answer on June 6, 2026 at 12:33 pm

    Try using, Port Forwarding

    From command prompt at adb location,

    adb forward tcp:8666 tcp:8666

    The forward command to set up arbitrary port forwarding — forwarding of requests on a specific host port to a different port on an emulator/device instance. Here’s how you would set up forwarding of host port 8666 to emulator/device port 8666:

    If this doesn’t help then post your code and logcat errors.

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

Sidebar

Related Questions

I have a client and a server app on Android (that uses ZeroC -
I have a simple client-server app on android. the android service communicates with the
I have dynamic listview on my android client app that receive data from remote
I have c++ socket server and android client. Server constantly sends data to the
I have an Android client that needs to authenticate with a python Google App
I am working on an Android app that uses the gdata-java-client to download documents
I am trying to create an android app that communicates with a local server
Im writing a client/server app for android that sends a username and password to
I'm having trouble getting a socket connection between Android(client) and a c# app(server) to
I have built a java server app and am trying to get my android

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.