Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
InternetConnect
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
01286143
Message ID:
01286563
Views:
24
Hi Juri, I'm using Rick Strahl's wwftp ftpconnect method. I list some of the code below. I'm not quite sure whether it's InternetOpen or InternetConnect which is failing. It usually works but fails roughly 1 out of 10 times.
hInetConnection=;
   InternetOpen("West Wind Web Connection 3.00",;
   THIS.nHTTPConnectType,;
   NULL,NULL,0)

IF hInetConnection = 0
   THIS.nError=GetLastError()
   THIS.cErrorMsg=THIS.GetSystemErrorMsg(THIS.nError)
   RETURN THIS.nError
ENDIF

THIS.hIPSession=hInetConnection
THIS.WinInetSetTimeout()

DECLARE INTEGER InternetConnect ;
   IN WININET.DLL ;
   INTEGER hIPHandle,;
   STRING lpzServer,;
   INTEGER dwPort, ;
   STRING lpzUserName,;
   STRING lpzPassword,;
   INTEGER dwServiceFlags,;
   INTEGER dwReserved,;
   INTEGER dwReserved


	lhFTPSession=;
	   InternetConnect(hInetConnection,;
	   lcServer,;
	   lnHTTPPort,;
	   lcUsername,;
	   lcPassword,;
	   INTERNET_SERVICE_FTP,;
	   THIS.nServiceFlags,0)


IF (lhFTPSession = 0)
   lnError = 0
   lcErrMsg = SPACE(256)
   lnErrLen = LEN(lcErrMsg)
   DECLARE INTEGER InternetGetLastResponseInfo ;
      IN WININET.DLL ;
      INTEGER @dwError,;
      STRING @szBuffer,;
      INTEGER @dwBufferLength
   
   lnResult = InternetGetLastResponseInfo(@lnError,@lcErrMsg,@lnErrLen)
      
   =InternetCloseHandle(hInetConnection)
   THIS.nError = GetLastError()
   IF THIS.nError = 0
      THIS.cErrorMsg = lcErrMsg
      THIS.nError = 1
   ELSE
     THIS.cErrorMsg = THIS.GetSystemErrorMsg()
   ENDIF
   RETURN THIS.nError
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform