Sample code for 30+ languages & platforms
Classic ASP

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 Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set socket = Server.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
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
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
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Reverted to a plain TCP connection.") & "</pre>"

%>
</body>
</html>