Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Port parameter in wininet.dll for FTP file transfer in VFP

Status
Not open for further replies.

Shamina

Programmer
Apr 18, 2018
2
ZA
thread184-480895

Hi Guys,

How can I enter the port I want the file to be transfered to using the FtpPut.prg in the linked thread?

Many thanks,
Shamina
 
Do you mean your target ftp server is not running on port 21 - it is perhaps on 4900 or somesuch?




Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I'm guessing a little but the ftpconnect function receives a host string, which might be something like

ftp.mysite.com

and could include a reference to a port using a colon delimiter thus

ftp.mysite.com:4910





Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Apparently there is a standard

Standard FTP URL format is recognized:
ftp://[user ID:password@]<host name>[:port]/[path name/]

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
DECLARE INTEGER InternetConnect ;
IN WININET.DLL ;
INTEGER hIPHandle,;
STRING lpzServer,;
INTEGER dwPort, ;
STRING lpzUserName,;
STRING lpzPassword,;
INTEGER dwServiceFlags,;
INTEGER dwReserved,;
INTEGER dwReserved

looks like the 3rd parameter to internetconnect

but i'm with Olaf - vfpconnectiom.fll (or westwind) will do most of the heavy lifting for you.

hth

n
 
While I haven't used it for a good while now, for 'generic' FTP operations I was using the routines found at:

Those routines use the Default FTP Port 21, but the parameter passed is '0' indicating USE THE DEFAULT PORT.

Good Luck,
JRB-Bldr
 
Hi Guys,

I have an FTP address like so: 00.000.000.000 and the port is 22 ...
Below is the function I'm using and passing a parameter called nServerPort which is declared publicly at the top of my program along with all other parameters - nServerPort holds the value 22.
However I'm still receiving a message saying the FTP address is not available.

Please assist:

Code:
FUNCTION  connect2ftp (lcHost, lcUser, lcPassword)   
   * open access to Inet functions    
   hOpen = InternetOpen ("vfp", 1, 0, 0, 0) 
	
   IF hOpen = 0    
      ? "Unable to get access to WinInet.Dll"   
      RETURN .F.   
   ENDIF   

   *... The first '0' says use the default port, usually 21.    
   hftpSession = InternetConnect (hOpen, lcHost, nServerPort, lcUser, lcPassword, 1, 0, 0)   &&... 1 = ftp protocol
   IF hftpSession = 0    
   * close access to Inet functions and exit    
      = InternetCloseHandle (hOpen)    
      ? "ftp " + lcHost + " is not available"   
      RETURN .F.   
   ELSE    
      ? "Connected to " + lcHost
   ENDIF    
RETURN .T.   
RETURN
ENDPROC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top