I have a question regarding multiple winsock connections between 1 server and several clients. Here is my setup:
I have 5 winsock controls on my form:
sckListen
sckRequest1
sckRequest2
sckAccept1
sckAccept2
In Form_Load I do
So now I have sckListen listening on port 7777.VB Code:
With sckListen .Bind .LocalIP, 7777 .Listen End With
I then have 2 command buttons that I click in this order:
VB Code:
Private Sub Command2_Click() sckRequest1.Connect sckListen.LocalIP, 7777 End Sub ' and then Private Sub Command3_Click() sckRequest2.Connect sckListen.LocalIP, 7777 End Sub
In my sckListen_ConnectionRequest I have this:
VB Code:
Private Sub sckListen_ConnectionRequest(ByVal requestID As Long) If sckAccept1.State = sckClosed Then sckAccept1.Accept requestID Else sckAccept2.Accept requestID End If End Sub
If I then check the states and ports of my winsock controls I see this:
Does this make sense? I want to be able to have one winsockCode:Listen: Listening LocalPort:7777
Request1: Connected LocalPort:2783
Accept1: Connected RemotePort:2783
Request2: Connected LocalPort:2784
Accept2: Connected RemotePort:2784
listening for any connection requests from clients, and it would
then create new winsock instances to accept those requests.
(I am familiar with loading and unloading new controls)
Is the above log correct? Are my Request and Accept winsocks now connected on those ports? So any data passed between them should not be lost or misplaced(even though my initial .Connect method was called with port 7777)?
