Results 1 to 8 of 8

Thread: How can I get address of wireless router

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How can I get address of wireless router

    Hi,

    I want to write an application which will listen for http requests.
    I have limited knowledge about networking so let me know if I am thinking it correctly.

    I am thinking that I will create QTcpServer listening at a particular port and when I get the request I can process it. But my PC is connected to internet via a wifi router. How can I get IP address of the wifi router and how can I setup the router so that it will forward request to my application running on my PC.

    Let me know if there is another way to do it.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I get address of wireless router

    What do you need the router address for?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I get address of wireless router

    Hi wysota,

    This is what I want to achieve.

    I want my application (lets call it Listener) to listen to http request from a webapp. Listener is running on a pc which is connected to internet via wifi router. The Ip address of pc on which Listener is running is 192.168.*.* (LAN address). Now if the webapp wants to send the request to Listener what is the best way to do it.

    I am thinking that I can ask the webapp to send the request to wifi router which will then forward(I am not sure how the router will forward request to Listener) it to Listener at a particular port where it would be expecting a request. That is why I need the ip address of router. Is that possible? Is there any better way to achieve that?

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I get address of wireless router

    Quote Originally Posted by dpatel View Post
    I am thinking that I can ask the webapp to send the request to wifi router which will then forward(I am not sure how the router will forward request to Listener) it to Listener at a particular port where it would be expecting a request. That is why I need the ip address of router. Is that possible? Is there any better way to achieve that?
    Why do you need the ip address of the router? The router is connected to the internet and its external address is known. The external app connects using the router's external IP address (which again is known) that then has to be setup to forward the connection to your local machine (read about "port forwarding" to learn how to do that). Your local machine doesn't need to know the address of the router. The router has to know the address of your local machine.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    dpatel (15th March 2011)

  6. #5
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I get address of wireless router

    Thanks wysota. Now I understand what you mean. I was not thinking it correctly. Thanks again.

  7. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I get address of wireless router

    If you want your application to automatically configure the Wifi router to port forward certain ports to your PC you can do it over UPnP (If enabled on your router, which it typically is by default).

    For a single application, this is not so useful, but if you are going to be installing your application on many PCs, it is a time saving feature.

  8. The following user says thank you to squidge for this useful post:

    dpatel (30th March 2011)

  9. #7
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I get address of wireless router

    Thanks squidge. Is there any library that you know of which I can use with Qt to configure the router ?

  10. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I get address of wireless router

    I've seen such libraries before (such as https://code.google.com/p/qupnp/) but have not used them so I can not say how well they work.

  11. The following user says thank you to squidge for this useful post:

    dpatel (30th March 2011)

Similar Threads

  1. getting IP-address
    By jefklak in forum Qt Programming
    Replies: 2
    Last Post: 23rd October 2010, 09:19
  2. Wireless Video
    By khrave in forum Qt Programming
    Replies: 54
    Last Post: 19th June 2010, 07:15
  3. how can i get IP address
    By dognzhe in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2009, 05:27
  4. IP address find
    By kpmsivachand in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2009, 18:11
  5. IP Address
    By rajveer in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2008, 08:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.