• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

Refresh fact programmatically (source code)

Started by cj, July 18, 2014, 03:33:19 PM

Previous topic - Next topic

cj

#DIM ALL
$RefreshFactString = CHR$(15,0,0,0,0,23,0,1,0,0,0,0,0,0,0)
'---------------------------------------------------------
FUNCTION PBMAIN AS LONG
  LOCAL result,PortNumber AS LONG
  LOCAL sIpaddress AS STRING
  PortNumber = 51234
  sIpAddress = "192.168.1.2"
  result = RefreshFACT(PortNumber&,sIpAddress)
  IF result = 0 THEN ? "Fact refreshed",,"Success"
END FUNCTION
'---------------------------------------------------------'
FUNCTION RefreshFACT(PortNumber AS LONG,_
                     sIpAddress AS STRING) AS LONG
  LOCAL hTCP AS LONG
  hTCP = FREEFILE
  TCP OPEN PORT PortNumber AT sIpAddress AS #hTCP
  IF ERR THEN
    FUNCTION = ERR
    EXIT FUNCTION
  END IF
  TCP SEND #hTCP, $RefreshFactString
  IF ERR THEN
     FUNCTION = ERR
     EXIT FUNCTION
  END IF
  TCP CLOSE #hTCP 'success, return 0
END FUNCTION