Bonjour à tous, je viens vous voir parceque j'ai un petit problème et pas moyen de comprendre pourquoi...
Donc voilà j'essaye de faire un petit programme qui se connecte sur mon serveur distant en VB via SSH j'utilise la dll extraputty, j'arrive à me connecter, j'arrive à lancer une commande (qui s’exécute, je laisse putty en visible pour voir les résultats) parcontre une fois la commande exécuter j'ai mon programme qui bug je peux plus rien faire, obligé de fermer.. donc voilà le code:

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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
Imports System.Runtime.InteropServices
Imports System.Security.Permissions
 
Public Class Form1
 
    ' Déclaration 
    <DllImport("ExtraPuTTY.dll", CallingConvention:=CallingConvention.StdCall)> _
    Private Shared Function CloseConnexion(ByVal ConnexionId As UInteger) As Integer
    End Function
    <DllImport("ExtraPuTTY.dll", CallingConvention:=CallingConvention.StdCall)> _
    Private Shared Function Connexion(ByVal TragetName As String, ByRef ConnexionId As Long, ByVal Log As String, ByVal Pass As String, ByVal Display As Integer, ByVal proto As Long, ByVal portnumber As Long, ByVal rapport As Long) As Integer
    End Function
    <DllImport("ExtraPuTTY.dll", CallingConvention:=CallingConvention.StdCall)> _
    Private Shared Function CloseAllConnexion()
    End Function
    <DllImport("ExtraPuTTY.dll", CallingConvention:=CallingConvention.StdCall)> _
    Private Shared Function SendRcvData(ByVal ConnexionId As Integer, ByVal Command As String, ByVal title As String, ByVal comment As String, ByRef bufdata As IntPtr, ByVal capt As Integer, ByVal Sizedata As Integer, ByVal Settings As Integer) As Integer
    End Function
 
    ' Constantes
    Private Const HOSTNAME = "monserveur"
    Private Const LOGIN = "monlogin"
    Private Const PASSWORD = "monmotdepass"
    Private Const PORT = 22
 
    ' Variables globales
    Dim isConnected As Long = 0
 
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        Dim result As Integer
 
        Dim PuttyVisible As Integer ' As Boolean (si masqué)
        PuttyVisible = 1 ' 1 => visible / false => masquer
 
        result = Connexion(Form1.HOSTNAME, isConnected, Form1.LOGIN, Form1.PASSWORD, PuttyVisible, 1, Form1.PORT, 0)
        Me.RichTextBox1.AppendText(result)
    End Sub
 
 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles test.Click
 
        Dim result As Integer
        Dim DataRcv As IntPtr = Marshal.AllocHGlobal(10000000)
 
        result = SendRcvData(isConnected, Me.commandBox.Text, "", "", 5000, DataRcv, 10000, 0) ' ça plante ici je crois
 
 
        Me.RichTextBox1.AppendText(result)
 
        If DataRcv <> IntPtr.Zero Then
            Marshal.FreeCoTaskMem(DataRcv)
 
        End If
 
        ' ConnectionId 	ConnectionId set by Connexion function (shall be > 0).	
        ' Command 	Data to send on the target, if the parameter is null the function is configured only in reception way.
        ' Title 	Title of your command,used only if extraputty report is activate.
        ' Comments 	Comments of your command,used only if extraputty report is activate.
        ' TimeCapture 	Time used to capture the reply data in ms.
        ' DataRcv 	Buffer which contains the data received if TimerCapture is > 0.
        ' MaxSizeofData 	Size of DataRcv Buffer or maximum data size in DataRcv (1 < MaxSizeofData < 20 000 000)
        ' Settings 	Bit field of settings (2^0 : CRLF (0 send,1 not send),2^1 : Virtual key codes (0 no virtual key codes in command,1 yes)...reserved)
 
    End Sub
 
End Class
voilà j'ai aussi mon "Me.RichTextBox1.AppendText(result)" qui une fois connecter aulieu de me dire les informations dans ma textbox me retourne "0".
merci à vous