Private intMax As LongPrivate Sub Form_Load()
intMax = 0
sckServer(0).LocalPort = 1001
sckServer(0).Listen
End SubPrivate Sub sckServer_ConnectionRequest _
(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load sckServer(intMax)
sckServer(intMax).LocalPort = 0
sckServer(intMax).Accept requestID
Load txtData(intMax)
End If
End Sub请教一下各位申请连接的时候SOCK控件的INDEX都是为0,那么为什么还要在事件里面还需要判断SOCK控件的INDEX是否为0呢?
intMax = 0
sckServer(0).LocalPort = 1001
sckServer(0).Listen
End SubPrivate Sub sckServer_ConnectionRequest _
(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load sckServer(intMax)
sckServer(intMax).LocalPort = 0
sckServer(intMax).Accept requestID
Load txtData(intMax)
End If
End Sub请教一下各位申请连接的时候SOCK控件的INDEX都是为0,那么为什么还要在事件里面还需要判断SOCK控件的INDEX是否为0呢?
或者以后要改为比如用Index0和Index1同时监听两个端口用的时候好区分是哪个端口来的请求?
或者那个判断是用于同时监听两个端口的时候用来区分是哪个端口进行连接的?