iHostConnect through a Proxy

Started by JTaylor, April 07, 2014, 07:14:38 AM

Previous topic - Next topic

JTaylor

Are there any known issues with doing iHostConnect through a Proxy?   Always get 12029 error no matter what I try.  Here is the basic code.   Any obvious problems?  I've put enough messages in the testing to be certain the proxy server, port, etc values are correct.

Thanks.

Jim

  tophandle=iBegin(1,proxy_host:":":proxy_port,"")

  conhandle=iHostConnect(tophandle,ftp_server,@FTPPASSIVE, ftp_user, ftp_pwd)
  If conhandle==0
    err = iGetLastError()
    Message("Error",err)
    Return
  EndIf
  x=iFtpPut(conhandle, rss_file,rss_file_new),0,@ASCII, @FALSE)
  If x==0
   up_stat = "Failed!!!"
  Else
   up_stat = "Successful!!!"
  EndIf
  iClose(conhandle)
  iClose(tophandle)

Deana

There are no known issues with specifying a proxy with WinInet. The Error 12029 indicates: ERROR_INTERNET_CANNOT_CONNECT  The attempt to connect to the server failed.

Does the proxy require a user id and password? If so see iOptionSet 'proxy_username' and 'proxy_password'.

Have you tried using tophandle=iBegin(2,"","")? This assumes MSIE is already properly configured on the system to use that proxy server.

http://windows.microsoft.com/en-us/windows/change-internet-explorer-proxy-server-settings#1TC=windows-7

Once you know the proper proxy setting s they can be coded in to the script.




Deana F.
Technical Support
Wilson WindowWare Inc.

JTaylor

Supposedly no user or password.  The challenge is that it isn't my setup and I have no proxy so as to test locally.   I have tried setting things up in IE and then using Option 2 but still no joy.   Just wanted to make sure my code looked right.   Have tried so many different things but never get past that error message.

Will keep plugging away....Thanks.

Jim

Deana

Your format looked okay....

Keep in mind that you can only use iBegin  AccessType 1 [Proxy server connect] - if the system on which the application is running uses one or more proxy servers to access the Internet.

See also:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WIL~Extenders/WinInet+iBegin~and~Firewalls.txt
Deana F.
Technical Support
Wilson WindowWare Inc.

JTaylor

Looked at that but not sure if it applies as it says I should specify the firewall (do proxies work the same?)  in the iHostConnect but all the iFtp stuff shows that being used for the Ftp server.   Am I missing something?

In any event, WinSCP worked on the first attempt so not sure what the different is between the two.   Guess I'll give up on WinInet and convert the application to use WinSCP unless someone has any other suggestions.  Would love to avoid another piece to the puzzle but not sure how to get around this issue.   Curious is anyone else is using iFtpPut through a proxy???

Jim

Deana

Do you happen to know if its a CERN-based proxy server? If so please see: http://support.microsoft.com/kb/166961/EN-US

The WinInet functions recognize only CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, these functions also support SOCKS proxies. FTP requests can be made through a CERN type proxy either by changing them to an HTTP request or by using iUrlOpen.
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

Here are some possible reasons why you are getting the error 12029:

WinInet error code 12029 is a Microsoft error code that translates to "The attempt to connect to the server failed." There are various possible explanations:

The URL is correct but the server is not running at the moment...  If the server was offline, try again when it becomes available 
The URL is correct but there is no network connection between the client and the server...  If the network connection between the client and server was disrupted, try again once it is reestablished 
The client's proxy settings prevent a connection to the server...  Adjust the client proxy settings in MSIE to allow connections to this server
The URL is incorrect... If the URL was incorrect, click the Edit Options button in the ribbon for the problem workbook and type or paste in the correct URL from the successful ping test.
Deana F.
Technical Support
Wilson WindowWare Inc.

JTaylor

Okay.   Not sure what they use for the proxy but maybe this is the issue.   Most of the other reasons for not connecting, while possible, are unlikely.   Everything worked fine without the proxy and there were two of us looking at everything we tried with numerous pop-ups to verify information so I think the settings were good.   Seems like a battle not worth fighting since WinSCP will do the job.   Plus, it also opens the possibility of secure transfers if someone needs that at some point.  Thanks again for the suggestions and information....and the WinSCP code you posted in the Tech DB.

Jim

Quote from: Deana on April 11, 2014, 08:11:01 AM
Do you happen to know if its a CERN-based proxy server? If so please see: http://support.microsoft.com/kb/166961/EN-US

The WinInet functions recognize only CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, these functions also support SOCKS proxies. FTP requests can be made through a CERN type proxy either by changing them to an HTTP request or by using iUrlOpen.