-
May 14th, 2013, 08:22 AM
#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.
-
May 15th, 2013, 04:08 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|