CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2013
    Posts
    1

    test establish ssh connection

    HI,

    may someone help me

    i just wanna do simple code via vb6 to test ssh connection what i mean it is like i have server for ex.

    192.168.1.30 user test pass test

    i wanna check if the server able to establish ssh connection? if yes write 1 if not write 0 on flat file as .txt

    1 means online
    0 means offline

    note: no ping or nslookup as they're disabled for security purpose by admin.

  2. #2
    Join Date
    Aug 2011
    Posts
    35

    Re: test establish ssh connection

    Try copying a file test.txt (empty) using File System Object and capture the error.
    Here is a sample code:

    Private Function Server_Test()
    Dim fs As New FileSystemObject
    On Error GoTo errH

    ' FolderName must exist on user computer
    fs.CopyFile App.Path & "\test.txt" ,\\192.168.1.30\FolderName\test.txt"

    'If the connection succeded, delete the file "test.txt"
    fs.DeleteFile

    MsgBox "Server is Running"

    Exit Function
    errH:
    MsgBox "Server is Stop"
    End Function

    usually the error code is #76 (Path not found)

    course can develop as Boolean function:
    Private Function Server_Test() As Boolean

    and the code of the function call looks like this:
    (somewhere in the application)
    If Not Server_Test
    do something...
    Else
    do something else...
    End If

    I hope you are a good starting point

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured