Visual Basic 6.0
Visual Basic 6.0
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 Visual Basic 6.0 Downloads
Dim success As Long
success = 0
Dim socket As New ChilkatSocket
' Connect to the server using TLS.
Dim bTls As Long
bTls = 1
Dim maxWaitMs As Long
maxWaitMs = 5000
success = socket.Connect("example.com",5000,bTls,maxWaitMs)
If (success = 0) Then
Debug.Print socket.LastErrorText
Exit Sub
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.
Dim dupSock As New ChilkatSocket
success = socket.DupSocket(dupSock)
If (success = 0) Then
Debug.Print socket.LastErrorText
Exit Sub
End If
Debug.Print "Duplicate socket wrapper created."