Sample code for 30+ languages & platforms
VBScript

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 VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set socket = CreateObject("Chilkat.Socket")

'  Connect to the server using TLS.
bTls = 1
maxWaitMs = 5000
success = socket.Connect("example.com",5000,bTls,maxWaitMs)
If (success = 0) Then
    outFile.WriteLine(socket.LastErrorText)
    WScript.Quit
End If

'  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.
success = socket.ConvertFromSsl()
If (success = 0) Then
    outFile.WriteLine(socket.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine("Reverted to a plain TCP connection.")

outFile.Close