Winsock m/ multiconnection
Har en form med en Microsoft Winsock Control 6.0Følgene kode giver fejlen:
Procedure declaration does not match description of event or procedure having same name.
----------------------------
Private Sub Form_Load()
Instances = 0
Winsock(0).LocalPort = 5000
Winsock(0).Listen
End Sub
Private Sub WinSock_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
Instances = Instances + 1
Load Winsock(Instances)
Winsock(Instances).LocalPort = 0
Winsock(Instances).Accept requestID
End If
End Sub
Private Sub WinSock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Winsock(Index).GetData tekst, vbString
For x = 1 To Instances
If (Winsock(x).State = 7) And x <> Index Then
\'Hvis afsenderen også selv skal modtage det sendte ser linjen således ud:
\'If (WinSock(x).State = 7) Then
Winsock(x).SendData tekst
End If
Next x
Debug.Print \"Control no. \" & Index & \": \" & tekst \'(overvåg trafik)
End Sub