Visual FoxPro
Visual FoxPro
Send Encoded Bytes over a Socket
See more Socket/SSL/TLS Examples
Demonstrates Socket.SendBytesENC, which decodes text using a named encoding (such as base64) and sends the resulting binary bytes.
Background. The ENC methods move raw binary data to and from printable text using a named encoding such as
base64 or hex, which is convenient for logging or for handling binary data as strings.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loSocket
LOCAL lnBTls
LOCAL lnMaxWaitMs
lnSuccess = 0
loSocket = CreateObject('Chilkat.Socket')
* Connect to the server using TLS.
lnBTls = 1
lnMaxWaitMs = 5000
lnSuccess = loSocket.Connect("example.com",5000,lnBTls,lnMaxWaitMs)
IF (lnSuccess = 0) THEN
? loSocket.LastErrorText
RELEASE loSocket
CANCEL
ENDIF
* Decode the text using the named encoding, then send the resulting binary bytes. Here the base64
* text "SGVsbG8=" decodes to the bytes for "Hello".
lnSuccess = loSocket.SendBytesENC("SGVsbG8=","base64")
IF (lnSuccess = 0) THEN
? loSocket.LastErrorText
RELEASE loSocket
CANCEL
ENDIF
? "Bytes sent."
RELEASE loSocket