Results 1 to 4 of 4

Thread: Native Mac Address

  1. #1
    Join Date
    Aug 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Natice Nac Address?

    Hi,

    I know that Ethernet Card 's Mac Address can be changed.
    Now I have a question:
    Through the function QNetworkInterface::hardwareAddress () we can obtain the native Mac Address or the Mac Address modified?

    Thanks
    Gennaro

  2. #2
    Join Date
    Aug 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Native Mac Address

    Hi,

    I know that Ethernet Card 's Mac Address can be changed.
    Now I have a question:
    Through the function QNetworkInterface::hardwareAddress () we can obtain the native Mac Address or the Mac Address modified?

    Thanks
    Gennaro

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Native Mac Address

    Quote Originally Posted by genny77 View Post
    Hi,

    I know that Ethernet Card 's Mac Address can be changed.
    Now I have a question:
    Through the function QNetworkInterface::hardwareAddress () we can obtain the native Mac Address or the Mac Address modified?

    Thanks
    Gennaro
    before i launch mysql connecto from external server i check network ...
    && it return forever the actual status....


    Qt Code:
    1. /* if external network is up? */
    2. static inline bool NetworkEnable() {
    3.  
    4. bool validip = false;
    5. QList<QHostAddress> addrlist = QNetworkInterface::allAddresses();
    6. int o = -1;
    7. foreach(QHostAddress addr, addrlist){
    8. o++;
    9. QNetworkInterface hop = QNetworkInterface::interfaceFromIndex(o);
    10. QString mach = hop.hardwareAddress();
    11. QString name = hop.name();
    12. QString oneip = addr.toString();
    13. if (!oneip.contains("127.")) {
    14. bool actual = hop.isValid();
    15. if (actual) {
    16. validip = true;
    17. }
    18. }
    19. }
    20. return validip;
    21. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Native Mac Address

    You can't rely on the Qt API on this one.
    You better use the platform API:

    Windows:
    http://www.codeproject.com/internet/NetCnfgVersion2.asp
    http://www.codeproject.com/internet/getmac.asp

    Linux:
    http://kasperd.net/~kasperd/comp.os....lopment.faq#IP
    See paragraph 29.

    Mac:
    Search http://developer.apple.com


    Regards

Similar Threads

  1. Ip Address Validation
    By bruccutler in forum Qt Programming
    Replies: 26
    Last Post: 3rd November 2010, 03:58
  2. Unable to resolve the IP address. ( Qt 3.)
    By joseph in forum Qt Programming
    Replies: 18
    Last Post: 5th July 2007, 12:02
  3. How to determine ip address of remote host?
    By nopalot in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2006, 21:18
  4. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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.