Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Members / jhb / pys60 / finding out our own ip

finding out our own ip

by Jörg Baach last modified Jun 13, 2009 04:43 PM
How to find out the mobile phones ip when using normal the normal socket module ( and not bt_socket)
import socket
aps = [ap['name'] for ap in socket.access_points()]
aps.sort()
apid = appuifw.popup_menu(aps,u'select access point')
socket.set_default_access_point(aps[apid])
#one time socket, for just finding out our ip
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#anonymity issue here
s.connect(('www.google.com',80))
ip = s.getsockname()[0]

Filed under:
Add comment

You can add a comment by filling out the form below. Plain text formatting.

Question: What is 23 plus 19?
Your answer: