Can FCConnect be configured to use a different port?

Looking at the NET-OS documentation there appears to be no place to set the outgoing client connection to a port other than the default port 21.

There is some vague reference to a function “FCHandleToSocket” but zero documentation on this function other than “This function is only recommended for very special programming

It requires a handle created by the call to FCConnect anyway so would seem to be after the fact anyway.

The goal here is to download a firmware file via the web interface from a ftp server but would prefer to not have it running on port 21.

Thanks,
Brooks

I just noticed a reference at the bottom of the API reference library for the FCConnect function stating “This protoptye was changed in NET+OS 7.4, but has been available since NET+OS 3.0. The port, timeout and use_pasv arguments were added in NET+OS 7.4.”

References port and timeout values to which I don’t see anything other than the FCSetPassive.

Hello
There is no code in the NET+OS version of the ftp client implementation for changing the port used to connect to the server. I found the reference to the “This prototype was changed” business. I believe this was included in error.

Hi,

Yes I was afraid you were going to confirm my findings. I’ll see if I can push this up to the folks at Digi and see if there is a chance for a patch to add that functionality. Should be simple to do. The odd function “FCHandleToSocket” would “appear” to almost have some leverage in that arena but my crystal ball is not working as well as it should so I’ll have to stick to port 21 until I know more…

Thanks for your knowledgeable input…would be nice to chat with you sometime directly but it appears the forum does not have any method of contacting other members via PM like phpBB etc.

When you call FCConnect() FCConnect returns to you a handle. That handle is the (malloced) address of a “control block” used by the FTP client for carrying around internal information. One of the pieces of information carried around is the control socket created when the FTP client connected to the FTP server. FCHandleToSocket() returns that control socket contained in the control block.

If you are familiar with NET+OS’s advanced web server, there is a similar handle that is used by many pbuilder calls. Digi does not want developers to directly manipulate the contents of the control block(s) so a handle is passed to the user for later use.

OK that makes sense. Thanks for your detailed reply!

I’ve got the AWS interface working to perform a FTP download from a external site and update the firmware successfully, but would prefer to run it on an obscure port other than port 21. (SFTP would be even better…)

We looked at moving to the Linux platform to take advantage of more readily available utilities, but the code port, web interface and hardware I/O changes would be currently to large of a hill to climb. We are looking to migrate to a more rich web interface using JQuery perhaps and I believe that this has been done successfully by others (?).

We are currently developing using the ConnectME 9210 and WiME 9210 plus the Connect Core 9215 (in another product). All using NET-OS.

Sorry to get off topic…

By default FCConnect does not support port number other than 21

you can try enabling undocumented extension by defining #define DPO_SOPS_SOFTWARE TRUE

Then use this function as:

FCConnect(char *server, char *user, char *pass, unsigned short port, unsigned int timeout, int use_pasv,
int *error_out)
{

This is absolutely unsupported so use it on your own risk. It also may turn on other undesired effects.

I would rather find a source code for a simple socket based ftp client and cross-compile it in to your application instead.

1 Like

Thanks Leonid. This has been confirmed via support. I appreciate the option, however I think we are going to move toward your suggestion. We already did similar (well, crafted our own for the most part) so to bypass the limitations of the MCMail library so that we can use SSL/TLS for email and attachments. So it looks like the ftp client is the next library to go in the on the retirement shelf…