Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2009

    Question How to get phone's ip

    So here's the deal:

    I wrote a server that runs on nokia phone
    import socket
    HOST = ''                 # Symbolic name meaning the local host
    PORT = 12008              # Arbitrary non-privileged port
    print "define the socket"
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    print "bind the socket"
    s.bind((HOST, PORT))
    print "waiting of the client to connect"
    conn, addr = s.accept()
    print 'Connected by', addr
    while 1:
        data = conn.recv(1024)
        if not data: break
    Source: http://www.mobilenin.com/pys60/resou...t_pc_server.py

    Everything ok so far BUT now writing a client on PC I need to know phone's ip so I can establis connection to it
    and I want application which runs on phone to tell me phone's ip... how do I do it?

    oh and this wont work:

    it sais there's no method "select_access_point()" or something like that

  2. #2
    Registered User
    Join Date
    Nov 2009

    Re: How to get phone's ip

    hi !

    Import btsocket and use this module for setting an access point. use the ip() method of the access point object to retrieve the current ip address.

    take care,

  3. #3
    Registered User
    Join Date
    Aug 2009

    Re: How to get phone's ip

    Thanks Julian... I did it with btsocket and ip() method... however I think problem was not in code but in my access point... I tried to set the access point manually on my N95 but apparently did something wrong...
    So I suggest the following procedure for setting up the access point:
    Connectivity -> Connection manager -> Available WLAN -> select the wlan and from the application menu select "create access point" or something similar
    Hope this will save some trouble to some of you...

  4. #4
    Registered User
    Join Date
    Aug 2009

    Re: How to get phone's ip

    Another problem :/
    apo.ip() method returns ip which starts with 169. which apparently means something went wrong
    in following tutorial it sais if you get 169 ip there is probbably something wrong with access point:
    but what?
    And weird thing is if I log into my wireless router and see which devices are connected to it I can see my phone with a valid 192.x.x.x ip assigned to it...

    I also wrote client in Java which runs on PC... I get error no matter which ip I use to log to the server on nokia... I will also try to write a client in C# since I am more familiar with it but I am pretty sure the problem is not on client but on server...

    anyone has any experience with this issue?
    Last edited by Agent_BK; 2011-02-21 at 19:56.

  5. #5
    Registered User
    Join Date
    Aug 2009

    Re: How to get phone's ip

    Noone knows the anwser?

    I temporarly solved the problem by setting static ip for the access point I am using but this is not a very practical way to do it... well at least I can establish connection now and apo.ip() returns the static ip I previously set up
    But I am still wondering why this won't work with dynamic ip and will always throw 169.x.x.x ip?

Similar Threads

  1. How to get the IP ?
    By Infernal01 in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2010-04-17, 09:59
  2. how to determine phone's IP address?
    By xchip in forum Symbian
    Replies: 12
    Last Post: 2008-04-20, 15:24
  3. how to get ip address?
    By kemang in forum Symbian
    Replies: 6
    Last Post: 2007-12-10, 14:06
  4. How to get a phone's product ID
    By patrickfrei in forum Symbian
    Replies: 6
    Last Post: 2007-12-07, 19:32
  5. How to get IP Address
    By chintankanani11 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-06, 11:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts