microbious Posted June 13, 2009 Share Posted June 13, 2009 what is the best way to tell if you are connected to FTP server ? is it : IF TCPRecv = <> "" then or: _FTPConnect = 1 then ? When i use TCPRecv and if FTP server has welcome message, i will then be able to read welcome message and count it as connected. But if FTP server does not have welcome message then i am unable to tell if i am connected or not. So maybe i need to somehow to be able to read what servers says in real time like LOG ? Little confused here Link to comment Share on other sites More sharing options...
martin Posted June 13, 2009 Share Posted June 13, 2009 what is the best way to tell if you are connected to FTP server ?is it : IF TCPRecv = <> "" thenor:_FTPConnect = 1 then?When i use TCPRecv and if FTP server has welcome message, i will then be able to read welcome message and count it as connected. But if FTP server does not have welcome message then i am unable to tell if i am connected or not.So maybe i need to somehow to be able to read what servers says in real time like LOG ?Little confused hereWhen you connect the return from _FTPConnect will tell you if you connected successfully. If you want to check later to see if you are still connected then you could see what the return is from something like _FTPGetCurrentDir. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
microbious Posted June 13, 2009 Author Share Posted June 13, 2009 oh ok. Thanks Link to comment Share on other sites More sharing options...
microbious Posted June 13, 2009 Author Share Posted June 13, 2009 No that doest not work because even if FTP port is set to 21 but u are connecting to port 22 it will still say that u are connected but u are not connected to FTP . U kinda connected to host but not to FTP so there must be another way to justify if connection was made correctly or not. Link to comment Share on other sites More sharing options...
Yashied Posted June 13, 2009 Share Posted June 13, 2009 (edited) #Include <FTP.au3> Global Const $Host = 'ftp.mozilla.org' Global Const $Login = '' Global Const $Password = '' Global Const $Port = 21 Global $hFtp, $hSession _FTP_Startup() $hFtp = _FTP_Open('MyFtp') _InternetSetOption($hFtp, $INTERNET_OPTION_CONNECT_TIMEOUT, 4000) $hSession = _FTP_Connect($hFtp, $Host, $Login, $Password, $Port) If @error Then MsgBox(0, '', 'Connect failed.') Else MsgBox(0, '', 'Connect successful.') EndIf _FTP_Disconnect($hSession) _FTP_Close($hFtp) _FTP_Shutdown()FTP.au3 Edited June 13, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
microbious Posted June 14, 2009 Author Share Posted June 14, 2009 this is not working. If i specify different port number it will still be connected no matter what. I used check current dir $concheck = _FTPGetCurrentDir($FTPopen);check if curent directory recived If $concheck = "" Then;if directory was not recived then SoundPlay (@TempDir & "/oops.wav",1);error sound ElseIf $concheck = "/" then SoundPlay (@TempDir & "/connected.wav",0); u are connected sound works better. This way if directory listed then i can be 100% sure i connected and server responded by listing current directory. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now