Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with using WinInet for FTP
Message
From
10/06/2002 12:22:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/06/2002 11:29:23
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00666544
Message ID:
00666583
Views:
17
>Hello All ;
> We wrote an App that hits our FTP server(which is running in NT 4.0,SP6)
>and it downloads/uploads files automatically based on Client Number / File Name. The process works great on our FTP server, however not at all when we change the settings to hit our Client's server(which is running with Unix). Is it not possible to connect to a Unix Server using WinInet, or are there some settings that I don't know about(We are currently setting the User Name, Password, Ip Address values only) ?
>
>P.S. - we are able to connect to their FTP Site using CuteFTP, so atleast we know the settings that we are using are correct.
>
>Any Suggestions?

Provided you declare the DLLS and have wininet.h as include file a form's init and connect button codes look like (and connects to unix with user/pw) :
*Form.init
thisform.hOpen = InternetOpen("My Connection", INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0)
if thisform.hOpen = 0
  messagebox("Couldn't start inet")
  return .F.
EndIf
thisform.dwSemantic = 0
thisform.hConnection = 0

*Connect button.click
With thisform
	If .hConnection # 0
		InternetCloseHandle( .hConnection )
	Endif

	.hConnection = InternetConnect(.hOpen, ;
		trim(.txtURL.Value), ;
		INTERNET_INVALID_PORT_NUMBER, ;
		trim(.txtUser.Value), ;
		trim(.txtPWD.Value), ;
		INTERNET_SERVICE_FTP, ;
		.dwSemantic, 0)

	If .hConnection=0
		.FtpResponse('Error connecting server')
	Else
		.FtpResponse('Connected.')
	Endif
Endwith

*Disconnect/close
With thisform
	If .hConnection # 0 Then
		If InternetCloseHandle( .hConnection ) = 0
			.FtpResponse('Error disconnecting.')
		Else
			.FtpResponse('Disconnected.')
			.hConnection = 0
		Endif
	Endif
Endwith
FtpResponse calls wininet dlls to get last response info and formats the messages to show connection and other dialogs. For this piece of code you could use messagebox instead.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform