Visual Basic 6.0
Visual Basic 6.0
Move a Connection into a Socket Set
See more Socket/SSL/TLS Examples
Demonstrates Socket.TakeSocket, which moves a connection into a newly created member of this object's socket set. After one or more calls, the object acts as a set of sockets.
Background. A socket set groups multiple connections so they can be monitored together with the SelectForReading and SelectForWriting methods. After success, the source socket holds no connection.
Chilkat Visual Basic 6.0 Downloads
Dim success As Long
success = 0
Dim listenSock As New ChilkatSocket
success = listenSock.BindAndListen(5000,25)
If (success = 0) Then
Debug.Print listenSock.LastErrorText
Exit Sub
End If
Dim connectedSock As New ChilkatSocket
success = listenSock.AcceptNext(20000,connectedSock)
If (success = 0) Then
Debug.Print listenSock.LastErrorText
Exit Sub
End If
' Move the connection out of connectedSock and into a newly created member of this object's socket
' set. After one or more such calls, socketSet acts as a set of connected sockets (useful with the
' SelectForReading / SelectForWriting methods). After success, connectedSock holds no connection.
Dim socketSet As New ChilkatSocket
success = socketSet.TakeSocket(connectedSock)
If (success = 0) Then
Debug.Print socketSet.LastErrorText
Exit Sub
End If
Debug.Print "Connection added to the socket set."