0

I have just implemented crow in my C++ application. The application now returns a result to a local host. Instead of uploading the result to a local host I want to connect to a FTP server and I can see the server through FileZilla. I have the host, username, password and port. How can i use crow to send my result there?

    std::cout << "1: OPTION 1" << std::endl;
    std::cout << "2: OPTION 2" << std::endl;
    std::cout << "3: OPTION 3" << std::endl;

    while (true) {
        int option;
        std::cout << "Enter option 1-3: ";
        std::cin >> option;

        //define your endpoint at the root directory
        CROW_ROUTE(app, "/")([&]() {

            if (option == 1) return "Option 1";

            if (option == 2) return "Option 2";
        
            if (option == 3) return "Option 3";

        });

        app.port(18080).multithreaded().run();
    };

Can not find anyone trying to connect to a cloud server

  • I don't think you can do that. Crow supports HTTP and Websocket, there is no mention of FTP on its home page. FTP is another application layer protocol. – kiner_shah Mar 10 '23 at 09:24
  • Do you have any suggestion on how I can connect to a server then? Should I go in another direction instead of Crow? – Afra Farkhooy Mar 10 '23 at 09:33
  • Maybe use some FTP client library. Maybe see [this](https://stackoverflow.com/questions/2919797/good-simple-c-c-ftp-and-sftp-client-library-recommendation-for-embedded-linux). – kiner_shah Mar 10 '23 at 09:34
  • 1
    `libcurl` has some [example](https://github.com/curl/curl/blob/master/docs/examples/ftpupload.c) how to upload a text file to ftp – pptaszni Mar 10 '23 at 09:36
  • Why (and what) do you want your web server to upload to an ftp server? – molbdnilo Mar 10 '23 at 10:05
  • My code is an application connecting with a camera. Each option is an argument telling the camera what to do, like "Take a photo". I want to upload the newly taken image to a FTP server. Im working with my master thesis and the images should be uploaded to a server to be accessed by others involved in my master thesis – Afra Farkhooy Mar 10 '23 at 10:24
  • For starters, I just want to see if I can connect to a FTP server, even with just a text file – Afra Farkhooy Mar 10 '23 at 10:26
  • You should not be using FTP in 2023. It is a terrible terrible terrible protocol. If all you need to do is store images, use S3 or one of its clones. You can even use MinIO or seaweedfs if you really need to deploy on a computer you own. – Botje Mar 10 '23 at 11:51

0 Answers0