Wow, flattered to be asked to post code :)
Actually it is such simple code that sends a url using the libcurl library. I made a loop that cycles 5 times sending each time a different url that will be received by a restful server written using mongoose. (hopefully when I write the final code it will be sending like 50 urls per second)
#include <stdlib.h>
#include <stdio.h>
#include <curl/curl.h>
int sendCurl(char *msg1)
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
printf("sending='%s'\n", msg1);
curl_easy_setopt(curl, CURLOPT_URL, msg1);
res = curl_easy_perform(curl);
if(res != CURLE_OK)
printf("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
int main() {
int y,c,x = 0;
char *clientRequest[200];
char restfulServer[100];
snprintf(restfulServer, REQLEN, "http://serverIP:port");
while (1)
{
printf("Enter:\n");
c = 0;
c=getchar();
while (c != '\n')
c=getchar();
if (x++==5)
break;
snprintf(clientRequest, sizeof(clientRequest), "%s/n1?msg=bodyofmsgno%i", restfulServer, x);
sendCurl(clientRequest);
}
return 1;
}