计算机毕业设计介绍:
点击【查看学生操作】系统将向此学生端发送要求返回当前学生端屏幕信息的命令,然后接受到此学生的屏幕数据后 调用窗体显示。
以下是引用片段: 相关代码如下: Private Sub WinConn_DataArrival(Index As Integer, ByVal bytesTotal As Long) If strZt = "22-22" Then '将接收到的数据信息写入文件中 直到文件长度等于发送过来的总长度 Dim aa() As Byte Dim str As String Me.WinConn(Index).GetData aa '把接收到的信息赋值给字符串a Open "D:\ReceiveScreen.rar" For Binary As #1 If LOF(1) + UBound(aa) + 1 <= intFileLen Then Put #1, LOF(1) + 1, aa Dim intCurrentLof As Long intCurrentLof = LOF(1) Debug.Print LOF(1) End If Close #1 If intCurrentLof = intFileLen Then If Dir("D:\SendScreen.bmp") <> "" Then Kill "D:\SendScreen.bmp" End If Call OutRar frmScreen.Show strZt = "" Exit Sub End If Else '判断相应接收标志的功能 Dim a As String Me.WinConn(Index).GetData a '把接收到的信息赋值给字符串a End If Select Case Mid(CStr(a), 1, 5) Case "22-22" If Dir("D:\ReceiveScreen.rar") <> "" Then Kill "D:\ReceiveScreen.rar" End If intFileLen = Mid(a, 6) strZt = "22-22" Exit Sub End Select End Sub Private Sub WinListen_ConnectionRequest(ByVal requestID As Long) '当接收到连接请求时,检索没有连接的winsock 让他与此连接 Dim i As Long For i = 0 To MaxClient - 1 If Me.WinConn(i).State = 0 Then Exit For End If Next If Me.WinConn(i).State = 0 Then Me.WinConn(i).Accept requestID Me.ListUser.ListItems.Add , "Con" & i, Me.WinConn(i).RemoteHostIP, 1 Exit Sub End If End Sub
|
<责任编辑:计算机毕业设计网(http://www.xiaoniu168.com)>