InternetConnectA returning 0

1030071002
1030071002 used Ask the Experts™
on
trying to build a ftp function put and get in powerbuilder 10.5
function  uLong InternetOpenA (string lpszAgent,  ulong dwAccessType, string lpszProxyName, string lpszProxyBypass, ulong dwFlags) library "wininet.dll"
function ulong InternetConnectA (ulong hInternet, string lpszServerName, ulong nServerPort, string lpszUsername, string lpszPassword, ulong dwService, ulong dwFlags,ulong dwContext) library "wininet.dll"
function boolean InternetCloseHandle (ulong hInternet) library "wininet.dll"
function boolean FtpSetCurrentDirectoryA (ulong hConnect, string lpszDirectory) library "wininet.dll"
function boolean FtpGetFileA (ulong hConnect, string lpszRemoteFile, string lpszNewFile, boolean fFailIfExists, ulong dwFlagsAndAttributes, ulong dwFlags, ulong dwContext) library "wininet.dll"
function boolean FtpPutFileA (ulong hConnect, string lpszLocalFile, string lpszRemoteFile, ulong dwFlags, ulong dwContext) library "wininet.dll"
 
ftp_send('ftp.gmgtranswest.com',21,'trnswst','tw0421','H:\Inetpub\ftproot\Test\consignee.xml','C:\TEMP\consignee.xml')
 
SetNull(NuL)
 
 //ll_hret = InternetOpenA ('GMG_FTP', 0, '', '10.0.0.58',0)
  ll_hret = InternetOpenA ('GMG_FTP', 1, Nul,NuL,1)
 if ll_hret = 0 or isnull (ll_hret) then
 	messagebox ('!', 'WinInet.Dll!', stopsign!)
  return "fail"
 end if
 
 ll_hftp = InternetConnectA(ll_hret, gmg_ftpserver, gmg_ftploginport, gmg_ftploginuser, gmg_ftploginpass, 1, 0, 2)
 
 if ll_hftp=0 then
 	   messagebox ('Error','Fail To Connect',stopsign!)
      InternetCloseHandle (ll_hret)
 			return "fail"
 end if
 
if not FtpPutFileA (ll_hftp, gmg_source_filename, gmg_target_filename, 1,0) then
 messagebox ('Error...', 'Fail to Send file ')
Else
 InternetCloseHandle (ll_hret)
 InternetCloseHandle (ll_hftp)
 return "File Send"
 
End if

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
I use Funcky 6.0 com Component as it has FTP support and it works great for me.  Funcky also has many other features available and it is really not that expensive.  It easily pays for itself and I often refer to it in solutions.

I do not work for Funcky or get paid in any way to recommend this product.  I am merely stating it as a resource as I use it personally in my solutions.

Once you install it and register the product it is simple to use.

Global variables
OLEOBJECT       FTP

Application Object
FTP = CreateObject("FUNCkyFTP")

FTP.CreateFTP( [Server ] [, Username ] [, Password ] [, Port ] [, Proxy ] )

IF FTP.STATUS = 0 THEN
     //CONNECTION GOOD
     FTP.ChangeDir("\wherever") //change directory if needed feature
     FTP.Get("Source File","Destination Location",0)
END IF

Funcky 6.0 did not work

Commented:
You have funcky 6.0?  It is a third party software and not normally included with Power Builder.

Author

Commented:
I know I download it try to use and got no where using pb 10.5

Commented:
Hmm it works for me.  What is happening?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial