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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:55:03+00:00 2026-06-07T13:55:03+00:00

I’ve installed sl4a and Python on my Android-powered Galaxy Tab. I’ve run into problems

  • 0

I’ve installed sl4a and Python on my Android-powered Galaxy Tab. I’ve run into problems using python’s socket module to communicate between my laptop and my phone.

This example had always worked fine for me when I’d been writing computer-only python programs, but doesn’t work as expected on a computer/Tab set-up. Here is the code I’m running on the Tab:

import socket, android
droid=android.Android()
droid.makeToast('Running...')
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 50111))
droid.makeToast('Socket has been bound')
s.listen(1)
conn, addr = s.accept()
droid.makeToast('Connection has been accepted')

And the code I’m executing on the laptop (where <Tab IP Address> is the IP address of the Tab):

import socket
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('<Tab IP address>', 50111))

The client script (on the laptop) errors with:

socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

And the script on the Tab displays all but the last Toast message.

I’m getting the IP address of the Tab from http://www.whatismyip.org.

Local socket programming (i.e. connecting to IP address ‘localhost’ and running both client and server on the Tab) works fine.

I’ve been using the guide here to transfer files to my Tab.

For context, the final desired goal of my project is to be able to send a text via my Tab by executing a command on my laptop. I’m sure solutions already exist, but I’d like to learn how to do it myself!

EDIT: [Added 21/03/12] It turns out that the code above works fine (communicating between Tab and Laptop) if I connect the Tab to my wifi network and use the 192.168.0.xx address. This leads me to believe that the problem lies with the IP address I’m using to connect to the Tab, rather than the code itself. I’ll keep trying. Any advice on the best way find the IP address to connect to, or errors I might be making, would be appreciated.

EDIT AGAIN: From reading this question and this link, I’ve concluded that smartphones’ (and tablets’) IP addresses are not static, and so treating the mobile device as the server in this situation is the wrong way to do it. I’ll rethink my program structure.
Although I know now that this was the wrong way to structure the interaction, I still don’t entirely understand why it failed. I suspect, from reading the earlier links, that the IP address I was getting from http://www.whatismyip.org wasn’t unique to my Tab, but was rather a “bulk IP” belonging to my network provider, from which connections can then be forwarded on to individual devices (in the same way that a network router can forward connections to itself on to individual devices on the network). However, I’m not certain of this, and can’t think of any way to verify it (short of hunting down people on the same network as me, who live in the same cell area, and asking them their mobile IP’s). If someone could clarify this point, I’d be very grateful.

  • 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-07T13:55:04+00:00Added an answer on June 7, 2026 at 1:55 pm

    You were right about the “bulk IP” thing. When you’re connecting your phone through wi-fi it will get a random IP from the router’s available IP address pool.

    It usually gets the same IP if you have a constant number of devices connected to the router. For example if you have 3 computers connected through cable and 1 smartphone then the phone will always get the 192.168.1.5 IP (192.168.1.2 – .4 IPs are used for your computers).

    Depending on the router you have you can set it up to give the exact same address to your smartphone every time you connect it to wi-fi. And the IP you were using from www.whatismyip.org is the one from the provider, which a network uses to reach “public internet” (but that’s another story).

    You should check your local IP that’s on your tablet (Settings->Wi-Fi->Wi-Fi settings-> and press the connection. A small info box should appear with your IP).

    You should use that in your code for the server.

    I hope this helped.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.