Home AMX User Forum AMXForums Archive Threads Tips and Tricks

Mac address as sting

Is it possible to get the macaddress of the ni-frame in a variable or constant so i can use it in a program?


  • You can send 'get IP' in a telnet session with the device and parse it out of the response
  • ericmedleyericmedley Posts: 4,177
    There is already a built in structure for this. I'm not at my computer right now but I think it's _IPAdress or _IP_ADRESS or something. You just need to declare the variable in DEFINE_VARIABLE and it will give you this kind of stuff. You might have to look this up until I or someone gts the real code.
  • viningvining Posts: 4,368
    I think this is what Eric is talking about and it works with GET_IP_ADDRESS:
    The function requires an IP_ADDRESS_STRUCT. The IP_ADDRESS_STRUCT is predefined as follows:
     CHAR  Flags          // Configuration flags
     CHAR  HostName[128]  // Host name
     CHAR IPAddress[15]   // IP address unit
     CHAR SubnetMask[15]  // subnet mask
     CHAR Gateway[15]     // IP address of gateway
    But as you look at the structure there's nothing for the MAC. I'm pretty sure there's no built in system's function that allows you to get the mac, GET_UNIQUE_ID returns the neuron ID. AFAIK the only way is to telnet into the master through code if that's what you mean by an NI frame and call GET IP, that will return the mac.

    If you're not sure how to telnet into a master via code I posted a module in ModPedia some time ago called PING_URL/GET_IP or something to that affect that establishes a telnet session to ping so instead of pinging you could call GET_IP.

    If your NI isn't a current firmware master telnet in through a PC and see if actually has the that function before wasting time. I just telnetted into an old NXC-ME in a card frame with old firmware and it has the function so you're probably good to go.
  • champchamp Posts: 261
    If you have defined the main RMSE module in your program (i.e. RmsNetLinxAdapter_dr4_0_0) you can do it with a ?CLIENT.MAC command to vdvRMS

    Command To [41001:1:1]-[?CLIENT.MAC]
    Command From [41001:1:1]-[CLIENT.MAC-00:60:9F:aa:bb:cc]
Sign In or Register to comment.