Hello,
I am having a problem sending binary data via TSocket(). Can someone help me correct the code to send binary data?
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oWnd, cRfid := "", cEol := CHR(13)+CHR(10)
cRfid += "^XA" + cEol
cRfid += "^RS8" + cEol
cRfid += "^FO50,50" + cEol
cRfid += "^A0N,65" + cEol
cRfid += "^FDHello Jason!!!" + cEol
cRfid += "^FS" + cEol
cRfid += "^RFW,A" + cEol
cRfid += "^FD00 rfid data" + cEol
cRfid += "^FS" + cEol
cRfid += "^XZ" + cEol
DEFINE WINDOW oWnd
@ 1, 2 BUTTON "Send";
SIZE 100, 50;
ACTION SENDDATA( 9100, "192.168.1.143", cRfid )
ACTIVATE WINDOW oWnd
RETURN NIL
STATIC FUNCTION SENDDATA( nPort, cIP, cRfData )
LOCAL oSocket := TSocket():New( nPort )
oSocket:bConnect := { || oSocket:SendData( cRfData ),;
oSocket:End(), MsgInfo( cRfData + " DATA SENT!" ) }
oSocket:bClose = { || MsgInfo( "disconnected!" ) }
oSocket:Connect( cIP )
RETURN NIL