Bonjour,
je cherche à faire une connection client - server avec le protocole tcp/ip mais je n'y arrive pas.
Mon code server :
Mon code client :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Private Sub Form_Load() tcpServer.LocalPort = 1001 tcpServer.Listen End Sub Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long) If tcpServer.State <> sckClosed Then tcpServer.Close tcpServer.Accept requestID End Sub Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long) Dim strData As String tcpServer.GetData strData TxtOutput.Text = strData End Sub Private Sub TxtSendData_Change() tcpServer.SendData TxtSendData.Text End Sub
je ne comprend pas pourquoi ça ne marche pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 Private Sub Form_Load() tcpClient.RemoteHost = "82.233.252.53" tcpClient.RemotePort = 1001 End Sub Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long) Dim strData As String tcpClient.GetData strData TxtOutput.Text = strData End Sub Private Sub Timer1_Timer() Label1 = tcpClient.State End Sub Private Sub TxtSend_Change() tcpClient.SendData TxtSend.Text End Sub Private Sub btn_connect_Click() tcpClient.Connect End Sub
merci
Partager