How to get the Ethernet ID List [SOLVED]



  • On 23/04/2018 at 13:21, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   16+ 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hello,

    As the title suggests, I am looking for a way to get the local Ethernet ID list, as displayed in the Personalize window. 
    I thought about using MachineInfo, but it does not provide the Enternet ID among its macros.

    Thanks for any help on the subject.



  • On 24/04/2018 at 02:43, xxxxxxxx wrote:

    Hi,

    By Ethernet ID I believe you mean MAC address.
    The API provides the function GetMacAddress() (declared in c4d_network.h ). Here's how it can be used:

    maxon::BaseArray<UChar> macAddress;
    if (GetMacAddress(macAddress))
    {
      String macAddressStr;
      for (Int32 i = 0; i < 6; i++)
      {
        if (i > 0)
          macAddressStr += "-";
      
        macAddressStr += String::HexToString((UInt32)macAddress[i], false).Right(2);
      }
      GePrint(macAddressStr);
    }
    


  • On 24/04/2018 at 05:33, xxxxxxxx wrote:

    Thank you for your reply Yannick.

    This however does not give me the DEFAULT ETHERNET ID (as displayed in Help-Personalize). It does give the Mac Address of the attached device, but as soon as it is unplugged, the returned value changes.

    So I am looking for a consistent way to get the default Ethernet Adapater Physical Address value, as in Help - Personalize, which lists the default Ethernet ID, plus any attached devices IDs.

    Thanks



  • On 25/04/2018 at 01:58, xxxxxxxx wrote:

    Hi,

    The Ethernet ID shown in the Personalize dialog is not given by GetMacAddress().
    The Cinema 4D API only provides GetMacAddress() to get the MAC address of the current machine.
    If it doesn't fit your needs then you should use an operating system function. There are useful resources on the web, for instance this interesting article with code.



  • On 25/04/2018 at 05:04, xxxxxxxx wrote:

    Thank you for the link Yannick.


Log in to reply