请看这段VB代码中的"红"数字, 我的问题是,这些数字是编程者自定义的,还是winsock内容定义的对应不同含义的代码?如为后者,最好给出更全的代码及其含义列表.
Public Function Handle_Data(strData As String, sSock As Winsock) As String
Dim strRead() As String, intCount As Integer
'I use the Array *strRead()* to split the data using a seperator
strRead() = Split(strData$, Sep)
With frmServer
'I use the Second number in the Data to intentify what function it is.
Select Case strRead(2)
'** Login
Case "92"
.lstOnline.AddItem strRead(4)
sSock.Tag = LCase(strRead(4))
Pause (0.2)
'Sends a list of the Clients
Call sSock.SendData(SendClientList)
Pause (0.2)
'Sends the newclient login to all connected clients
For intCount% = 1 To .Ws().UBound
Select Case .Ws(intCount%).State
Case Is = sckConnected
.Ws(intCount%).SendData NewClient(strRead(4))
DoEvents%
End Select
Next intCount%
'Displays data
Call Add_Data("Login", strData$)
'** Send ChatText to all the clients
Case "03"
'Sends data
For intCount% = 1 To .Ws().UBound
Select Case .Ws(intCount%).State
Case Is = sckConnected
.Ws(intCount%).SendData strData$
DoEvents%
End Select
Next intCount%
'Displays ChatText in the Server
.txtChat.Text = .txtChat.Text & strRead(3) & ": " & strRead(4) & vbCrLf
.txtChat.SelStart = Len(.txtChat.Text)
Call Add_Data("Chat Send", strData$)
'** Whisper
Case "05"
'If the user is not found, we exit the function
If FindSock(strRead(3)) = "11111" Then Exit Function
'Send to client
.Ws(FindSock(strRead(3))).SendData Whisper(strRead(3), sSock.Tag, strRead(4))
DoEvents%
Call Add_Data("Whisper", strData$)
'** Client LOGOFF
Case "831"
'Removes user
Call Remove_User(sSock.Tag, .lstOnline)
Pause (0.1)
'Notifys everybody of this clients logoff
For intCount% = 1 To .Ws().UBound
Select Case .Ws(intCount%).State
Case Is = sckConnected
.Ws(intCount%).SendData strData$
DoEvents%
End Select
Next intCount%
'Clears tag so we can accept the next incoming connection
sSock.Tag = ""
Call Add_Data("Logout", strData$)
End Select
End With
End Function
Public Function Handle_Data(strData As String, sSock As Winsock) As String
Dim strRead() As String, intCount As Integer
'I use the Array *strRead()* to split the data using a seperator
strRead() = Split(strData$, Sep)
With frmServer
'I use the Second number in the Data to intentify what function it is.
Select Case strRead(2)
'** Login
Case "92"
.lstOnline.AddItem strRead(4)
sSock.Tag = LCase(strRead(4))
Pause (0.2)
'Sends a list of the Clients
Call sSock.SendData(SendClientList)
Pause (0.2)
'Sends the newclient login to all connected clients
For intCount% = 1 To .Ws().UBound
Select Case .Ws(intCount%).State
Case Is = sckConnected
.Ws(intCount%).SendData NewClient(strRead(4))
DoEvents%
End Select
Next intCount%
'Displays data
Call Add_Data("Login", strData$)
'** Send ChatText to all the clients
Case "03"
'Sends data
For intCount% = 1 To .Ws().UBound
Select Case .Ws(intCount%).State
Case Is = sckConnected
.Ws(intCount%).SendData strData$
DoEvents%
End Select
Next intCount%
'Displays ChatText in the Server
.txtChat.Text = .txtChat.Text & strRead(3) & ": " & strRead(4) & vbCrLf
.txtChat.SelStart = Len(.txtChat.Text)
Call Add_Data("Chat Send", strData$)
'** Whisper
Case "05"
'If the user is not found, we exit the function
If FindSock(strRead(3)) = "11111" Then Exit Function
'Send to client
.Ws(FindSock(strRead(3))).SendData Whisper(strRead(3), sSock.Tag, strRead(4))
DoEvents%
Call Add_Data("Whisper", strData$)
'** Client LOGOFF
Case "831"
'Removes user
Call Remove_User(sSock.Tag, .lstOnline)
Pause (0.1)
'Notifys everybody of this clients logoff
For intCount% = 1 To .Ws().UBound
Select Case .Ws(intCount%).State
Case Is = sckConnected
.Ws(intCount%).SendData strData$
DoEvents%
End Select
Next intCount%
'Clears tag so we can accept the next incoming connection
sSock.Tag = ""
Call Add_Data("Logout", strData$)
End Select
End With
End Function
解决方案 »
- vb怎么给这种时间做加法,比如:00:13:13,496给加上00:13:20,287?DateAdd好像没法加毫秒的吧?
- 关于CommonDialog1的显示位置问题.
- 我做了个VB编程的助手程序,这是第二个测试版本,添加了些很多功能,光编译的可执行文件就1.8MB多。大家帮我看看行不行。
- 怎么注册商业activex组件
- 如何用DTPICKER 做日期的转换???
- 哪几个api函数可以代替
- !!??!!
- 很简单的问题,请速指教!!!
- 急!在线等待!解决立刻就给100分!高手请进!急!!!
- 奇蠢问题!在ACCESS里能不能建视图?如果可以,在哪里?
- 重大问题(救命)
- 一个表单的input参数,提交后被改写,求相关还原函数
在整个工程里搜索strRead找找
这些是编程的人自己定义的定义的意思是,这些数字他知道怎么处理,但是,你别想找到和它相关dim什么的东西。就好像你输入个数字,然后你的程序安装你输入的数字来决定分支一样,只有你知道怎么分支,别人也只有看程序和注释才知道是代表什么意义