Lianja
Lianja
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 Lianja Downloads
llSuccess = .F.
loSocket = createobject("CkSocket")
// Connect to the server using TLS.
llBTls = .T.
lnMaxWaitMs = 5000
llSuccess = loSocket.Connect("example.com",5000,llBTls,lnMaxWaitMs)
if (llSuccess = .F.) then
? loSocket.LastErrorText
release loSocket
return
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.
llSuccess = loSocket.ConvertFromSsl()
if (llSuccess = .F.) then
? loSocket.LastErrorText
release loSocket
return
endif
? "Reverted to a plain TCP connection."
release loSocket