Home AMX User Forum NetLinx Studio

Wake On Lan

Does anybody try to switch on a PC through Wake On LAN using NI Controller?
:p:p:p

Comments

  • SendStringSendString Posts: 19
    Try this:

    Try this, it works:
    PROGRAM_NAME='WakeOnLan,Rev 0' 
    
    DEFINE_DEVICE
    TP=10001:1:0
    
    DEFINE_VARIABLE
    
    slong Result   // if 0 then Port opened
    integer connected
    MAC[6]             // MAC-Adress of the Computers Network-card (6 Bytes)
    START[6]          // 6 x $FF, Part of the 'Magic Packet'
    
    DEFINE_START
    
    MAC="$00,$B0,$D0,$A0,$C2,$DE"  //Example
    START="$FF,$FF,$FF,$FF,$FF,$FF"
    Result=99
    
    DEFINE_PROGRAM 
    
    Push[tp,1]
    {   
      Result=IP_CLIENT_OPEN (2,'255.255.255.255', 2304, 2)  // Open port with Broadcast adress and Port=2304 , UDP
       if(result=0)
       {      
          connected=1
          result=99      
       }   
    }
     Push[tp,2]
    {   
       IP_SERVER_CLOSE (2)   
       connected=0
    }   
    Push[tp,3]    // Magic Packet: 6 x $FF, 16 x Mac-Adress
    {
       send_string 0:2:1,"START,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC,MAC"   }
    
    [tp,1]=connected
    [tp,2]=(!connected)
    
  • Thanks for help.
    :):):)
  • I created a module for this a while ago.
    Please try it....

    Regards, Leon
  • Leon,

    Thanks for sharing.

    Cheers,
    Charles
  • adamjbadamjb Posts: 4
    Sorry I never responded to say thanks for the help it was greatly appreciated.
    Adam
  • Hello

    I have a VDR (Reelbox) with the MAC Aresse: 00-1B-73-71-64-58

    Is it really MAC = "$00,$1B,$73, $71, $64, $58"

    Unfortunately does not work

    From the computer works with Windows 00-1B-73-71-64-58 (program WAKEON)

    Thank you
  • bobbob Posts: 296
    Interesting, when I use the straight command it works but doesn't when use I the supplied module from Leon.
  • smckintysmckinty Posts: 7
    I had issues using MAC addresses from a string (eg sMACaddress = '01A623B745C8'), then discovered that if I converted each hex set to an integer using HEXTOI, I could send them instead, after recombining them into a single string:

    (Based on the MAC above)
    nHexToNumber[1] = HEXTOI('01')
    nHexToNumber[2] = HEXTOI('A6')
    .
    .
    nHexToNumber[6] = HEXTOI('C8')

    sParsedMACAddress = "nHexToNumber[1],nHexToNumber[2],nHexToNumber[3],
    nHexToNumber[4],nHexToNumber[5],nHexToNumber[6]"

    SEND_STRING 0:2:0,"START,sParsedMACAddress,sParsedMACAddress,
    sParsedMACAddress,sParsedMACAddress,sParsedMACAddress,sParsedMACAddress,
    sParsedMACAddress,sParsedMACAddress,sParsedMACAddress,sParsedMACAddress,
    sParsedMACAddress,sParsedMACAddress,sParsedMACAddress,sParsedMACAddress,
    sParsedMACAddress,sParsedMACAddress"

    As far as I can tell, the problem was that as a string, each hex set ('01', 'A6', etc) is treated as 2 bytes ('0'+'1', 'A'+'6"...) giving 12 in total, but the MAC address can only be 6. By converting to an integer, each number is sent as a single byte (MAC above translates to 1, 166, 35, 183, 69, 200)


    At least, that's my understanding of it all - happy to get further clarification.

    May not be the cleanest way to do it - but at least I know it works!
  • Sendstring's method works for me in 2019, long live netlinx

    changed port to port 9 for my network though !

  • feddxfeddx Posts: 183

    @johnzac said:
    Hello

    I have a VDR (Reelbox) with the MAC Aresse: 00-1B-73-71-64-58

    Is it really MAC = "$00,$1B,$73, $71, $64, $58"

    Unfortunately does not work

    From the computer works with Windows 00-1B-73-71-64-58 (program WAKEON)

    Thank you

    If you are trying to use the WoL module in 2024, I might have some help for you.

    The module is looking for a Char value, so give it one.

    I found this works for the mac address:

    Char cMac_Hex[6] = {$BE,$EF,$70,$FE,$ED,$FF}

    And this doesn't:

    integer cMac_Hex[6] = {$BE,$EF,$70,$FE,$ED,$FF}

Sign In or Register to comment.