资源预览内容
第1页 / 共8页
第2页 / 共8页
第3页 / 共8页
第4页 / 共8页
第5页 / 共8页
第6页 / 共8页
第7页 / 共8页
第8页 / 共8页
亲,该文档总共8页全部预览完了,如果喜欢就下载吧!
资源描述
一下标注。红色全部为不懂不会的,绿色为标记信息Main code Private Declare Sub Sleep Lib kernel32 (ByVal dwMilliseconds As Long)Public ServerPort As String 连接端口号Public SockInt As Integer 当前有多少个连接开始工作Public SockData As Variant 当前连接数组 (Variant 数据类型来替换任何数据类型)Public SockUser As Variant 当前连接的用户ID判断是否与客户端连接并调用 mycocket_send 过称Private Sub ColBut1_Click() If MiniNumber.Text = Then text 名称为minninumber EchoLog (请在输入框中输入要关闭的灯具缩微编号) End If If SockInt 0 And SockData(i) = True Then /关闭已建立连接的端口号 Unload mySocket(i) /释放内存 End If Next SockInt = 0 / 将连接数置0 ReDim SockData(0) /重新定义数组,相当于清空数组 ReDim SockUser(0) SendUser.Clear /将加载到控件中的数据项清空,表示连接的用户为空 SendUser.AddItem 全部用户, 0 /重新加载全部用户items项 SendUser.ListIndex = 0 /将下拉菜单中的定义默认选择项 Call EchoLog(监听已经停止.)End Sub存储日志,显示日志Public Sub EchoLog(LogText) 日志在哪里 LineShow.Text = LineShow.Text & Format(Now(), H:M:SS) & - & LogText 含义是什么 LineShow.Text = LineShow.Text & vbCrLfLineShow.SelStart = Len(LineShow.Text) / 换行,将设置焦点End Sub点击发送按钮Private Sub SendBut_Click() If SockInt = 0 Then LineShow.Text = LineShow.Text & 尚未客户端连接,无法发送数据! LineShow.Text = LineShow.Text & vbCrLf SendText.SetFocus Exit Sub End If If SendText.Text = Then LineShow.Text = LineShow.Text & 请输入您要发送的内容! 他的内容到底是什么 使原有信息吗 LineShow.Text = LineShow.Text & vbCrLf SendText.SetFocus Exit Sub End If EchoLog (服务器: & SendText.Text) If SendUser.ListIndex = 0 Then Call mySocket_Send(0, SendText.Text) Else For i = 0 To UBound(SockUser) / Ubound(aa)应该等于数组aa的长度-1 If SendUser.Text = SockUser(i) Then Call mySocket_Send(CInt(i), SendText.Text) Exit For End If Next End If SendText.Text = SendText.SetFocusEnd Sub= 连接部分 =自定义发送数据类Public Function mySocket_Send(Index As Integer, SendText As String) As Boolean If Index = 0 Then If SockInt SockInt Then m
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号