Opretter 2 connection
Hvordan kan det være, at de multi connection winsock servere, laver 2 fremfor 1?Altså når en connecter til min client, så siger serveren der er 2 på?
Og når der kommer en mere ind, siger den der er 4?
Selvom standard er sat til 0 og plusser ved hver der kommer?
Option Explicit
Dim intConnection As Integer
Private Sub Form_Load()
intConnection = 0
'centers form
Left = (Screen.Width - Me.Width) \ 2
Top = (Screen.Height - Me.Height) \ 2
'displays the connection status
lblConnected.Caption = "0"
'winsock will listen on port 55
Winsock(0).LocalPort = 9999
Winsock(0).Listen
End Sub
Private Sub Winsock_Close(Index As Integer)
lblConnected.Caption = lblConnected.Caption - 1 'takes one off the connection status
End Sub
Private Sub Winsock_ConnectionRequest(Index As Integer, ByVal requestID As Long)
intConnection = intConnection + 1
Load Winsock(intConnection)
Winsock(intConnection).Accept requestID
lblConnected.Caption = lblConnected.Caption + 1
End Sub
