curl-library
libcurl crash - curl_easy_perform() ???
Date: Tue, 21 Jun 2005 18:35:32 +0100
Dear all,
I am having a terrible problem with my software. I have already sent an
email in the last week, and I got some problems that were corrected by a
member. However, the main problem is still there. I would appreciate if
someone can help me.
I am using libcurl to perform GET operations to an equipment. When I
perform the GET operations, sometimes the libcurl is blocked and my
program stops. If I look to the reply packet in ethereal I can see that
the reply to the GET message was completely sent to me by the external
equipment, but libcurl was not able to process/write it. Everytime I
want to perform a GET operation, I am opening the file file to write,
and after the reception of the reply message I am closing the file and
performing an fflush(). However, I still have the problem. I copy in
this email a small part of the code (sorry for this) for someone to give
me a hand:
struct textfile
{
char *filename;
FILE *writestream;
};
struct textfile file = {"teste.txt", NULL};
.........
for(mt_ss_elem_find = mt_ss_elem_head; mt_ss_elem_find != NULL;
mt_ss_elem_find = mt_ss_elem_find->next)
{
inet_ntop(AF_INET,
&(mt_ss_elem_find->ss.SS_IPv4_remote_addr), SS_IPv4_remote_addr,
INET_ADDRSTRLEN);
/ file.writestream = fopen(file.filename, "w");/
fprintf(stderr, " Adding MT MAC address to SS SF0
...");
sprintf(url_mac_addr_config,
"http://%s/C2E?HAD=%x%%3A%x%%3A%x%%3A%x%%3A%x%%3A%x&ADD=Add",
SS_IPv4_remote_addr,
mt_ss_elem_find->mt.MT_L2_addr[0],
mt_ss_elem_find->mt.MT_L2_addr[1],
mt_ss_elem_find->mt.MT_L2_addr[2],
mt_ss_elem_find->mt.MT_L2_addr[3],
mt_ss_elem_find->mt.MT_L2_addr[4],
mt_ss_elem_find->mt.MT_L2_addr[5]);
/ curl_easy_setopt(handle, CURLOPT_URL, url_mac_addr_config);
curl_easy_setopt(handle, CURLOPT_WRITEDATA,
file.writestream);
curl_easy_perform(handle);
fflush(file.writestream);
fclose(file.writestream);/
fprintf(stderr, " completed\n");
/ file.writestream = fopen(file.filename, "w");/
fprintf(stderr, " Adding MT NS address to SS SF0
...");
sprintf(url_mac_addr_config,
"http://%s/C2E?HAD=33%%3A33%%3AFF%%3A%x%%3A%x%%3A%x&ADD=Add",
SS_IPv4_remote_addr,
mt_ss_elem_find->mt.MT_L2_addr[3],
mt_ss_elem_find->mt.MT_L2_addr[4],
mt_ss_elem_find->mt.MT_L2_addr[5]);
/ curl_easy_setopt(handle, CURLOPT_URL, url_mac_addr_config);
curl_easy_setopt(handle, CURLOPT_WRITEDATA,
file.writestream);
curl_easy_perform(handle);
fflush(file.writestream);
fclose(file.writestream);/
fprintf(stderr, " completed\n");
}
..................
This is a small part of the program. Maybe I am doing something wrong in
the curl_easy_perform() function.
Thanks in advance for the time and for the help.
Best Regards,
Pedro Neves
Received on 2005-06-21