当前位置:首页 > CSU通信网原理课程设计
If InStr(1, S, \ Call SendToAll(S) '广播方式 Else
recUser = Left(S, InStr(1, S, \ S
=
Right(S,
Len(S)
-
Len(recUser)
Len(\
Call SendToOne(S, FindSckIndex(recUser))
If user(index) <> recUser Then Call SendToOne(S, index) End If
'将所发信息也写入服务器
Call AddToText1(S) End Sub
46
-
Private Sub sckServer_Error(index As Integer, ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As _ Long, CancelDisplay As Boolean)
userState(index) = 4 '客户端非正常终止 Call Stop_sckServer(index, userState(index)) End Sub
'利用winsock的State属性给所有连接在服务器上的客户发消息 Private Sub SendToAll(msg As String) For i = 0 To MaxChan - 1
If sckServer(i).State = 7 Then
sckServer(i).SendData Trim(msg)
DoEvents
End If
47
共分享92篇相关文档