Salut tout le monde j'ai créer un logiciel et il ne fonctionne pas, il refuse de se connecter c'est un logiciel de type framwork voici le code serveur et client
serveur :
Code:Private Sub ReactorButton1_Click_1(sender As System.Object, e As System.EventArgs) Handles ReactorButton1.Click Winsock1.LocalPort = 8080 Winsock1.Listen() End Sub Private Sub Winsock1_ConnectionRequest(sender As Object, e As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles Winsock1.ConnectionRequest Winsock1.Close() Winsock1.Accept(e.requestID) End Sub Private Sub Winsock1_DataArrival(sender As Object, e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles Winsock1.DataArrival Dim data As String = "" Dim opt() As String Winsock1.GetData(data) opt = Split(data, "||") Select Case opt(0) Case "connecté" Me.Text = "Connecté !" PictureBox1.BackColor = Color.Lime Case "MSG" If ReactorMultiLineTextBox1.Text = "" Then ReactorMultiLineTextBox1.Text = (ReactorMultiLineTextBox1.Text & "Message de " & opt(1)) Else ReactorMultiLineTextBox1.Text = (ReactorMultiLineTextBox1.Text & vbCrLf & "Message de " & opt(1)) End If MsgBox("Message de " & opt(1), MsgBoxStyle.Exclamation, "Nouveau Message") Case "déconecté" Me.Text = "Cuisine " PictureBox1.BackColor = Color.Red End Select End Sub
et voici le client :
part1 :
part2 :Code:Private Sub Button40_Click(sender As System.Object, e As System.EventArgs) Handles Button40.Click If Button1.Text = "Se connecter" Then On Error Resume Next Winsock1.Close() Winsock1.Connect(TextBox2.Text, TextBox5.Text) End If End Sub Private Sub Winsock1_ConnectEvent(sender As Object, e As System.EventArgs) Handles Winsock1.ConnectEvent Me.Text = "Caisse connecté !" Button40.BackColor = Color.Lime Winsock1.SendData("connecté" & "||") End Sub
Code:Dim txtpsd As String = ("Caisse" & " : " & Form3.RichTextBox1.Text) Dim txtmy As String = ("Moi" & " : " & Form3.RichTextBox1.Text) On Error Resume Next Winsock1.SendData("MSG" & "||" & txtpsd)
-----