HTTP Request API

Home Forums MultiConnect OCG HTTP Request API

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4851
    Greg Ludewig
    Participant

    I’m a Linux (and especially a CoreCDP) newbie, so I have what’s probably a pretty basic question. Is there a CoreCDP API I can use for my application to send HTTP POST, GET, and PUT requests?

    #4852
    Mike Fiore
    Blocked

    Greg,
    Are you looking for an application like Curl , which would allow your application to make HTTP (or other protocol) requests to external servers?

    If so, the answer is yes. In fact, there is a bitbake recipe for curl in openembedded already.

    -Mike

    #4853
    Greg Ludewig
    Participant

    Mike,

    thanks for the quick response. I don’t know anything about Curl, but after reading about it a little, it seems like what I might really want is to use libcurl directly so that I can access it from my application.

    Basically, I need to be able to send HTTP POST, PUT, and GET requests to a server in JSON format. If Curl/libcurl are avaiable in CoreCdp I should be able to do that from an application running on the OCG-E, right?

    Greg

    #4854
    Jesse Gilles
    Blocked

    Hi Greg,

    Yes, both curl and libcurl are available in CoreCDP. If you are writing a C/C++ application, then libcurl is a good choice. We use it for development here at Multi-Tech and it works quite well.

    Yes, you should be able to do it on the OCG-E. You will just need to build and link your application using the CoreCDP toolchain (see documentation on this site for toolchain location) and make sure you have a ppp connection dialed before making HTTP requests.

    Jesse

    #4855
    Mike Fiore
    Blocked

    That’s exactly it. Libcurl is not by any means the only C/C++ HTTP client library out there in the wild, but it is pretty well known and well used. I’ve used it before and haven’t really had any issues to speak of.

    You should just need to add curl to your image recipe in CoreCDP and include the curl headers in your project.

    I would also suggest checking out JSON libs if you haven’t already. I’ve used JsonCPP in conjunction with curl and they work quite nicely together.

    I don’t think there’s a recipe for JsonCPP in OpenEmbedded, but you might be able to find one out in the wild.

    -Mike

    #4856
    Greg Ludewig
    Participant

    Thanks for the help, guys!

    I’ve got a few more newbie questions I was wondering if you guys could help me with:

    I’ve been using a pppd script to open my connection. Is the best way to do that from my program to just call system(“pppd call cdma &”), or is there a function that would work better? Likewise, when I’m done with the connection, do I just use system(“killall pppd”) to close the connection?

    #4857
    Mike Fiore
    Blocked

    Greg,
    We don’t provide a C/C++ library for managing the PPP connection, so system() commands are a good alternative for managing the link from within your application. What you suggested should work just fine.

    -Mike

    #4859
    Greg Ludewig
    Participant

    OK, thanks.

    One last thing. If I want to install a program and have it run automatically at boot time, I assume there’s a script somewhere that I need to update. From what little I know of Linu, I think it depends on what run-level I’m using. Is there some documentation somewhere you could point me to that would explain it?

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.