Hello,
 
I am trying to use the cURL C++ API for TFTP file transfers.  I am using
curlpp-0.7.0 
and curl-7.16.2 libraries.  I get an error indicating No URL is set!  I
have 
included the a snippet of code below followed by output.  Any help would
be greatly
appreciated.
 
 
**************************************
size_t Tftp::tftpFRead(void* buffer, size_t size, size_t nitems)
{
    printf("tftpFRead:  size = %d  nitems = %d  ", size, nitems);
    return (0);
}
 

int Tftp::put(const char* pLocalFileP, const char* pRemoteFileP)
{
    TftpFile tftpFile = {const_cast<char*>(pLocalFileP), NULL};
    /**
    *  Get TFTP handle and test for proper initialization.
    */
    cURLpp::Easy curlTftpHandle;
    CURLcode curlError = CURLE_OK;
    string url;
 
    try
    {
        /**
        *  Indicate to cURL this is an upload operation.
        */
        curlTftpHandle.setOpt(new cURLpp::Options::Upload(true));
 
        /**
        *  Indicate to cURL the URL to use for the transfer.
        */
        url = url + URL_SCHEME + pAddressM + ":" + pPortM + "/" +
basename(const_cast<char*>(pRemoteFileP)) + ";" + pModeM;
        printf("URL: %s\n", url.c_str());
        curlTftpHandle.setOpt(new cURLpp::Options::Url(url.c_str()));
 
        /**
        *  Indicate to cURL the callback function to use for the
transfer.
        */
 
curlTftpHandle.setOpt(cURLpp::Options::ReadFunction(cURLpp::Types::ReadF
unctionFunctor(tftpFRead)));
 
        /**
        *  Send the file to TFTP server.
        */
        curlTftpHandle.perform();
    }
    catch ( cURLpp::LogicError & e )
      {
        printf("The following is a logic error: ");
        std::cout << e.what() << std::endl;
      }
    catch ( cURLpp::RuntimeError & e )
      {
        printf("The following is a runtime error: ");
        std::cout << e.what() << std::endl;
      }
 
    return (curlError);
}
**********************************************
 
 
OUTPUT BELOW:
 
Tftp constructor:  IP Address = easy  Port = 69  Transfer Mode = mode=I
URL: tftp://easy:69/JOHNNY;mode=I
The following is a runtime error: No URL set!
 
 
 
 
_______________________________________________
cURLpp mailing list
[email protected]
http://www.rrette.com/mailman/listinfo/curlpp

Reply via email to