/
Sample Application

Sample Application

  1. This example show how to initialize µC/FTPs:
    1. Start the FTP server's instance.

  2. This example assumes the presence of µC/TCP-IP and µC/FS. It is assume also that all prerequisite modules have been initialized before starting to initialize µC/HTTPs and any web server instance.


#define  FTPs_PASSIVE_IP_ADDR  "192.168.1.2" 
#define  FTPs_PASSIVE_PORT             2000 
           
CPU_BOOLEAN  FTPs_AppInitServer (void  *p_arg) 
{ 
    NET_IPv4_ADDR  addr;     
    CPU_BOOLEAN    success; 
    NET_ERR        net_err; 
            
 
    addr = NetASCII_Str_to_IPv4((CPU_CHAR *) FTPs_PASSIVE_IP_ADDR,     /* See Note #1.                        */
                                (NET_ERR  *)&net_err); 
    if (net_err != NET_ASCII_ERR_NONE) {
        return (DEF_FAIL);
    }
 
    success = FTPs_Init(addr, FTPs_PASSIVE_PORT, DEF_NULL);            /* See Note #2.	                      */                    
    if (success != DEF_OK) {
        return (DEF_FAIL);
    }
 
    return (DEF_OK);
}
  1. Convert passive string address to IPv4 address (public/internet host address).
  2. Initialize the μC/FTPs module with secure mode disabled. The module is then ready to accept standard requests from clients.

Related content