Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Connect to my ssh server via lokal port

$
0
0

Hi,

 

I created simple proxy to allow me to connect to my secure sh server.

But i cannot successfully connect.

 

From the tips, it say successfull connection over it. But still cant connect to my server.

 

Here is my code:

AutoIt         
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region $Form1 = GUICreate("helper", 285, 164, 311, 280) $proxyport = GUICtrlCreateInput("proxyport", 120, 40, 145, 21) $Button1 = GUICtrlCreateButton("START", 16, 112, 113, 33) $Button2 = GUICtrlCreateButton("STOP", 152, 112, 113, 33) $Label5 = GUICtrlCreateLabel("Proxy Port     :", 32, 40, 70, 17) GUISetState(@SW_SHOW) #EndRegion While 1     $nMsg = GUIGetMsg()     Select         Case $nMsg = $GUI_EVENT_CLOSE             Exit       Case $nMsg = $Button1       Local $_proxyport = GUICtrlRead($proxyport)            ;SERVER!! Start Me First !!!!!!!!!!!!!!!             Local $g_IP = "127.0.0.1"             ; Start The TCP Services             ;==============================================             TCPStartup()             ; Create a Listening "SOCKET"             ;==============================================             Local $MainSocket = TCPListen($g_IP, $_proxyport,100)             If $MainSocket = -1 Then Exit             If @error <> 0 Then                 MsgBox(0,"Error",@error)                 Exit              EndIf ;~                        While True                 Do                     $ConnectedSOCKET = TCPAccept($MainSocket)                     Sleep(10)                 Until $ConnectedSOCKET <> -1                 TrayTip("Connected","Someone connect to server.",3)                                 Sleep(10)                 If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket)             WEnd     EndSelect WEnd OnAutoItExitRegister("Cleanup") Func Cleanup()     ;ON SCRIPT EXIT close opened sockets and shutdown TCP service     ;----------------------------------------------------------------------     If $ConnectedSocket > -1 Then         TCPSend($ConnectedSocket, "~~bye")         Sleep(2000)         TCPRecv($ConnectedSocket, 512)         TCPCloseSocket($ConnectedSocket)     EndIf     TCPCloseSocket($MainSocket)     TCPShutdown() EndFunc   ;==>Cleanup

Viewing all articles
Browse latest Browse all 12506

Trending Articles