Author Topic: GetLANIPs in Rexx  (Read 4379 times)

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 284
  • Karma: +5/-0
    • View Profile
GetLANIPs in Rexx
« on: August 19, 2019, 07:10:45 pm »
This code detect available IP-numbers in the LAN...
Code: [Select]
...
   !_host_!.0 = 0
   CALL RxGetLANIP
   DO !_i_! = 1 TO !_host_!.0
      !_host_!.!_addr = !_host_!.!_i_!.!_addr
      CALL SockGetHostByAddr !_host_!.!_addr, '!_host_!.!_'
      PARSE VALUE RxClamDScan( 'zVERSION' ) WITH ...
... and yes, it's possible to use a rexx only procedure to scan files with a clam server using the newer calling method starting with the letter z.
Code: [Select]
RxGetLANIP: PROCEDURE EXPOSE !_host_!.
   !_lan_! = RXQUEUE( 'Create', 'GETLANIP' )
   CALL RXQUEUE 'Set', !_lan_!
   DO WHILE QUEUED() > 0; PARSE PULL; END;
   '@ping 255.255.255.255 56 1 2>>&1|RXQUEUE '!_lan_!
   !_i_! = 1
   DO WHILE QUEUED() > 0
      PARSE VALUE LINEIN( 'QUEUE:' ) WITH '64' . . !_host_!.!_i_!.!_addr':'.
      !_dot_! = POS( '.', !_host_!.!_i_!.!_addr )
      IF 0 < !_i_! THEN
      DO !_j_! = 2 TO 3
         !_dot_! = POS( '.', !_host_!.!_i_!.!_addr, !_dot_! + 1 )
         IF 0 = !_dot_! THEN !_j_! = 4
      END
      IF 0 < !_dot_! THEN !_i_! = !_i_! + 1
   END
   !_host_!.0 = !_i_! - 1
RETURN

Regards,
//Jan-Erik