Visual FoxPro
Visual FoxPro
Revert a TLS Connection to Plain TCP
See more Socket/SSL/TLS Examples
Demonstrates Socket.ConvertFromSsl, which ends the TLS layer while leaving the underlying TCP connection open for subsequent unencrypted communication.
Background. This is the reverse of a STARTTLS-style upgrade and is valid only while TLS is currently active on the connection.
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
* End the TLS layer while keeping the underlying TCP connection open for subsequent unencrypted
* communication. This is the reverse of a STARTTLS-style upgrade and is valid only while TLS is
* active.
lnSuccess = loSocket.ConvertFromSsl()
IF (lnSuccess = 0) THEN
? loSocket.LastErrorText
RELEASE loSocket
CANCEL
ENDIF
? "Reverted to a plain TCP connection."
RELEASE loSocket