Private Sub Command1_Click()
Dim bit()     As Byte
Open "D:\Mir_Image.bmp" For Binary As #1
ReDim bit(LOF(1) - 1) As Byte
Get 1, 1, bit
Close 1
TcpClient.SendData bit
End Sub
Private Sub Form_Load()
TcpServer.LocalPort = 1001
TcpServer.Listen
TcpClient.RemoteHost = "192.168.1.101"
TcpClient.RemotePort = 1001
TcpClient.Connect
End Sub
Private Sub TcpServer_DataArrival(ByVal bytesTotal As Long)
Dim bit()     As Byte
Static size     As Long
If size = 0 Then
Open "D:\Images.bmp" For Binary As #1
size = 1
End If
TcpServer.GetData bit
size = size + bytesTotal
If size >= 14454 Then          '改成传文件的大小
Put #1, , bit
Close #1
MsgBox "ok"
Else
Put #1, , bit
End If
End Sub
Private Sub TcpServer_ConnectionRequest(ByVal requestID As Long)
If TcpServer.State <> sckClosed Then _
TcpServer.Close
TcpServer.Accept requestID
End Sub