Jump to content

How does FTPeek_IsConnected work?


Fabian

This topic is 1676 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I tried using this function to keep the connection active, but it seems it still gives me "1" even when the FTP server has disconnected. If I connect, then use this to check every 30s, then leave it for 10 minutes or so and then try uploading/downloading a file I get error as if I am no longer connected.

Is it actually checking with the FTP server?

If not using this function, any suggestions on how to keep the connection active (we are talking minutes, not hours)?

 

Link to comment
Share on other sites

Hi Fabian,

Calling this function is not going to keep the connection active as it doesn't reach out to the server. What I did discover is that if the connection to the FTP server goes stale and the connection is closed by the FTP server rather than disconnecting from the client side, the FTPeek_IsConnected function will still return one. I have reported this as an issue to our issue tracking system but it may be something that is inherent in the FTP code library we are utilizing. What I recommend is rather than keeping the connection open where it could go stale, anytime you need to transfer/download a file: connect, do the transfer of the file, and disconnect. This will prevent the connection from being closed by the server and will eliminate the need for the IsConnected function. 

Link to comment
Share on other sites

11 hours ago, ryan360Works said:

What I did discover is that if the connection to the FTP server goes stale and the connection is closed by the FTP server rather than disconnecting from the client side, the FTPeek_IsConnected function will still return one. 

Yes, so I can't see any use at all for this function, as I would typically use it to check I'm still connected before I upload or change directory (I think this is from your sample file).

Quote

What I recommend is rather than keeping the connection open where it could go stale, anytime you need to transfer/download a file: connect, do the transfer of the file, and disconnect. This will prevent the connection from being closed by the server and will eliminate the need for the IsConnected function. 

Thanks for the suggestion. That is how I do it when the team sends a file from FM and then I show them a dialogue box to confirm if everything was ok. However, they doubt the file is actually on the supplier FTP server, and don't believe the desired folders have been created, so they skip using FM and use their FTP client ("Fetch") instead. Compliance is a challenge... ;)

I would like to show them the FTP directory much like the they see it in Fetch (actually I believe I need to do better...) and I have everything ready, except for this part. When they are in Fetch and get disconnected, Fetch will not tell them and will keep showing the directory, and if they click a folder it will reconnect seamlessly and open the folder. Same thing if they drop a file on the window, it will reconnect and upload.

The way they use Fetch, they might be "connected" for 15 minutes or so. I'm thinking that the easiest way to achieve a similar behaviour with FM/360 is to make sure the connection stays open. I was testing with FTPeek_GetCurrentDir (set to a variable, without using the result), and it looks like it might do the trick. Still, that is a workaround, so keep me informed if you fix the problem.

Link to comment
Share on other sites

This topic is 1676 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.