[Qt-interest] Get NIC information of Machine

Rahulkumar Tibdewal rahulkumar_tibdewal at persistent.co.in
Thu Aug 27 10:36:45 CEST 2009


Thanks David.
You used Solid references for getting information about network up down events.
I wonder what's there on MAC?

Anyways thanks.

Rahul

-----Original Message-----
From: David Boosalis [mailto:david.boosalis at gmail.com] 
Sent: Thursday, August 27, 2009 11:46 AM
To: Rahulkumar Tibdewal
Cc: Qt-interest at trolltech.com
Subject: Re: [Qt-interest] Get NIC information of Machine

I've been able to use Qt for getting network info  Hope it helps.
Incidentaly, if you did not already know it, the Solid references
below relates to KDE::Solid API for getting notification about network
up and downs events.

Hope this is of some use to you. Remember to add network to *.pro file

QT+=network
--------------------------------------
void NetworkInfo::updateConnection()
{
  QString name;
  QNetworkInterface ni;
  QNetworkAddressEntry qna;

  ni = QNetworkInterface::interfaceFromName("eth0");
  QList <QNetworkAddressEntry> addresses = ni.addressEntries();
  QListIterator <QNetworkAddressEntry> iter(addresses);
  while (iter.hasNext()) {
    qna = iter.next();
    qDebug() << "Address = " << qna.ip();
    break; // for me I assume first one;
  }
  name = qna.ip().toString();
  ipField->setText(name); // QTextLine
  macField->setText(ni.hardwareAddress());
  name = qna.netmask().toString();
  netmaskField->setText(name);

  if(Solid::Networking::status()==Solid::Networking::Connected ||
      Solid::Networking::status()==Solid::Networking::Unknown)
    name = "Connected";
  else
    name = "Disconnected";

  statusField->setText(name);


}


On Wed, Aug 26, 2009 at 10:47 PM, Rahulkumar
Tibdewal<rahulkumar_tibdewal at persistent.co.in> wrote:
> Hello All,
>
>
>
> I need to get details of the NIC present on Mac machine.
>
> Physical as well as virtual NICs present.
>
>
>
> Is there anything in Qt for this.
>
>
>
> Can anyone help me?
>
>
>
> Thanks
>
> Rahul
>
> DISCLAIMER ========== This e-mail may contain privileged and confidential
> information which is the property of Persistent Systems Ltd. It is intended
> only for the use of the individual or entity to which it is addressed. If
> you are not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Ltd. does not accept any liability for
> virus infected mails.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.




More information about the Qt-interest-old mailing list