Send Binary via TSocket()

Send Binary via TSocket()

Postby cdmmaui » Mon Jun 04, 2012 9:01 pm

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
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 107 guests