Classic ASP
Classic ASP
Duplicate a Socket Wrapper Sharing the Connection
See more Socket/SSL/TLS Examples
Demonstrates Socket.DupSocket, which populates a destination Socket with another wrapper that shares this object's underlying connection.
Background. The shared connection is reference-counted, and all wrappers operate on the same live connection. The destination first releases any connection it previously held.
Chilkat Classic ASP Downloads
<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
' Create a second Socket wrapper that shares this object's underlying connection. Both wrappers
' operate on the same live connection; the shared connection is reference-counted.
set dupSock = Server.CreateObject("Chilkat.Socket")
success = socket.DupSocket(dupSock)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Duplicate socket wrapper created.") & "</pre>"
%>
</body>
</html>