Jump to content

Most ftp functions hang but why?


martin
 Share

Recommended Posts

I cannot get many ftp functions to work any more. I assume that it must be something to do with the configuration on the ftp site but I can't see what. If I use some ftp client programs they work fine (Tried 3)

I can open an ftp channel, set and get the current directory. I can't list files, get files or put files.

I have tried making a script as simple as possible to see what goes wrong but I have made no progress for 2 days.

This is my test script. Can anyone suggest what might make calls to Wininet hang, which is what is happening.

#include <ftp.au3>
$server = 'xxxxxx'
$username = 'xxxxxxx'
$pass = 'xxxxxxx'

Local $hDll = DllOpen("Wininet.dll");have to do this for the ftp routines to work
if $hDll = -1 then
    msgbox(0,'Error','Could not open WIninet.dll')
Else
    test()
    DllClose($hDll)
EndIf


Func test()
    Const $FTP_TRANSFER_TYPE_ASCII = 0x01
    Const $FTP_TRANSFER_TYPE_BINARY = 0x02
    Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000

    $Open = _FTPOpen('MyFTP Control')
    if $Open = 0 then
        MsgBox(0,'ftp','Did not open')
        Exit
    EndIf

    $Conn = _FTPConnect($Open, $server, $username, $pass)
    if @error = -1 then
        msgbox(0,'error','Connect failed')
    EndIf
    
    msgbox(0,'ftp','Going to put a file')
    [color=#FF6666];;next line hangs, and if I check ftp.au3 it hangs on  DllCall('wininet.dll',...[/color]
    $Ftpp = _FtpPutFile($Conn, 'C:\Temp\ftptest.txt', 'test1.txt',$FTP_TRANSFER_TYPE_BINARY)
    if @error = -1 then
        msgbox(0,'error','Put failed')
    EndIf
    
    $Ftpc = _FTPClose($Open)

EndFunc

I have tried setting the read write execute permissions on the remote folders, tried running scripts on other computers but no good.

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...