×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    how to determine phone's IP address?

    Is there any simple way?

    On a PC is easy I just have to do this:

    Code:
    host = socket.gethostname()
    port = 80
    c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    c.bind((host, port))
    c.listen(1)
    but it doesn't seem to work on pys60

    Thanks
    Last edited by xchip; 2008-04-13 at 22:01. Reason: adding more details

  2. #2
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: how to determine phone's IP address?

    Could any Nokia member please help on this?

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: how to determine phone's IP address?

    hi xchip
    i think its a question related to hardware.
    ask a person who know about hardwares.
    thanks

  4. #4
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: how to determine phone's IP address?

    Quote Originally Posted by xchip View Post
    Code:
    host = socket.gethostname()
    port = 80
    c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    c.bind((host, port))
    c.listen(1)
    but it doesn't seem to work on pys60
    Which part fails? Is access point properly set?
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  5. #5
    Regular Contributor
    Join Date
    Dec 2007
    Location
    India
    Posts
    133

    Re: how to determine phone's IP address?

    Quote Originally Posted by xchip View Post
    Is there any simple way?

    On a PC is easy I just have to do this:

    Code:
    host = socket.gethostname()
    port = 80
    c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    c.bind((host, port))
    c.listen(1)
    but it doesn't seem to work on pys60

    Thanks
    Use this code on PyS60 to get Phone Ip address

    Code:
    import socket
    ap_id = socket.select_access_point()
    apo = socket.access_point(ap_id)
    apo.start()
    print "PHONE IP IS", apo.ip()
    Works fine for me
    Kandyfloss

    V 7.0642.0
    18-10-06
    RH-51
    Nokia 7610

  6. #6
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: how to determine phone's IP address?

    awesome, straight to the point!

  7. #7
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: how to determine phone's IP address?

    Hold on, apo.ip() returns a wrong ip address, it returns 169.254.234.80 and my router gives ip's in the range of 192.168.1.*

    What am I doing wrong? I'm so close now!!!
    Thanks
    Last edited by xchip; 2008-04-17 at 00:57.

  8. #8
    Registered User
    Join Date
    Dec 2004
    Posts
    1

    Re: how to determine phone's IP address?

    Quote Originally Posted by xchip View Post
    Hold on, apo.ip() returns a wrong ip address, it returns 169.254.234.80 and my router gives ip's in the range of 192.168.1.*

    What am I doing wrong? I'm so close now!!!
    Thanks
    DHCP failed so your router didn't gave you any IP (that's what 169.254.234.80 means).

    Check your AP settings

  9. #9
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: how to determine phone's IP address?

    hi xchip
    that code is correct it gave right IP address for my device. Infact the point mobilplayer has said that is also correct please check the settings.
    thanks

  10. #10
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: how to determine phone's IP address?

    Quote Originally Posted by gaba88 View Post
    hi xchip
    that code is correct it gave right IP address for my device. Infact the point mobilplayer has said that is also correct please check the settings.
    thanks
    Exactly, when I try connecting to the access point using python the router says:
    "Could not find DHCP daemon to get information"
    but when I use the nokia web browser I do get an IP address

    Has anyone experienced the same trouble?
    Thanks
    Last edited by xchip; 2008-04-19 at 16:08.

  11. #11
    Regular Contributor
    Join Date
    Dec 2007
    Location
    India
    Posts
    133

    Re: how to determine phone's IP address?

    Quote Originally Posted by xchip View Post
    Exactly, when I try connecting to the access point using python the router says:
    "Could not find DHCP daemon to get information"
    but when I use the nokia web browser I do get an IP address

    Has anyone experienced the same trouble?
    Thanks
    This is because of the access point settings.
    I bet when you connect using the same access point using the default browser, you get ip address.
    And to check whether your ip address is correctly shown correctly or not, use a site like checkmyip.com or findmyip.com to find out the ip address and compare with the ip that you get.
    Dynamic IP will be different everytime you connect to the connection.
    Kandyfloss

    V 7.0642.0
    18-10-06
    RH-51
    Nokia 7610

  12. #12
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: how to determine phone's IP address?

    hi xchip
    kandyfloss is absolutely correct. plz follow the way and give a feedback.

  13. #13
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: how to determine phone's IP address?

    kandyfloss,

    Let me restate my problem, hopefully now its more clear

    a) If I use the default browser, that is I launch the browser, I connect to my access point and then I just go to yahoo or whatever.. this works fine, I do get get a proper IP address (I can see the phone in the list of leased devices) up to here all is fine

    b) If I use python, that is I run my script, I connect to the access point, I don't get a proper address and in my router's log I can see the following error message "Could not find DHCP daemon to get information"

    What is more amazing is that if I copy and paste my script instructions on the bluetooth console all goes fine.

    I dont think I have to change anything in my router since I have a bunch of handheld devices and all work flawlessly... its just python

    Thanks

Similar Threads

  1. Originating Address and Alphanumeric Originating Address
    By orcsoft in forum General Messaging
    Replies: 3
    Last Post: 2007-04-22, 03:18
  2. Any vendor specific AT commands for Nokia phones
    By jasthy in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2006-12-07, 10:08
  3. Binding to Remote IP address Fails with -1
    By girish_1978 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-08-08, 20:36
  4. Binding to Remote IP address Fails with -1
    By girish_1978 in forum Symbian
    Replies: 0
    Last Post: 2006-08-04, 20:29

Posting Permissions

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