Jump to content


Photo

Urlopen Error Errno 111


  • Please log in to reply
2 replies to this topic

#1 xiav

xiav

    New Member

  • Members
  • Pip
  • 2 posts

Posted 06 January 2011 - 09:55 PM

I am running on Ubuntu 10.04. I am using AVD on Eclipse. When trying the example in
chapter 8 - page 276 I am getting Errno 111. The android app is not able to connect to the
python HTTPSever (using the simple_httpd example).

Can you help me resolve this issue?
Thank you.

Note: I made one change to the example code:
web_server = 'http://127.0.0.1:8080'

#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 07 January 2011 - 01:10 AM

When you use 127.0.0.1 this is the "localhost" address, which is shorthand for "the IP address of the device I am currently running on".

When you use that address on your Android device (real or emulated), Python looks for a web server running on the Android device (and, of course, there isn't one - your web server is running on your PC, in your case: your Ubuntu system). To work out the IP address to use, enter "ifconfig" at the Ubuntu command prompt and use the IP address reported within the Python code on your Android device. On my home computer, these addresses always start with 192.168.1.xxx, as my home broadband uses NAT to allow multiple connections share my broadband's single outward-facing IP address.

Try this and see what happens.

--Paul.

#3 xiav

xiav

    New Member

  • Members
  • Pip
  • 2 posts

Posted 08 January 2011 - 04:08 PM


Thank you Paul. It worked.

QUOTE (paulbarry @ Jan 7 2011, 01:10 AM) <{POST_SNAPBACK}>
When you use 127.0.0.1 this is the "localhost" address, which is shorthand for "the IP address of the device I am currently running on".

When you use that address on your Android device (real or emulated), Python looks for a web server running on the Android device (and, of course, there isn't one - your web server is running on your PC, in your case: your Ubuntu system). To work out the IP address to use, enter "ifconfig" at the Ubuntu command prompt and use the IP address reported within the Python code on your Android device. On my home computer, these addresses always start with 192.168.1.xxx, as my home broadband uses NAT to allow multiple connections share my broadband's single outward-facing IP address.

Try this and see what happens.

--Paul.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users