Thanks for the reply
Now I have removed free at start of the loop.Here is the caller
Code:
int
get_pop3_Message (pop3_account pa, int (*callback) (int, char *))
{
SOCKET sClient;
struct sockaddr_in server;
char outbuffer[DEFAULT_BUFFER];
char *inbuffer;
sClient = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
inbuffer = NULL;
if (sClient == INVALID_SOCKET)
{
return POP3_SOCKET_FAILED;
}
if (DSNResolution (&server, pa.pop_server, pa.pop3_port) ==
POP3_HOST_RES_FAILED)
return POP3_HOST_RES_FAILED;
if (connect (sClient, (struct sockaddr *) &server, sizeof (server)) ==
SOCKET_ERROR)
{
return POP3_CONNECT_FAILED;
}
GetCommandData (&inbuffer, &sClient, "\r\n");
printf ("-><-%s\n",inbuffer);
free(inbuffer);
sprintf (outbuffer, "user %s \r\n", pa.user);
SendCommandData (outbuffer, &sClient);
GetCommandData (&inbuffer, &sClient, "\r\n");
printf ("-><-%s\n", inbuffer);
free(inbuffer);
sprintf (outbuffer, "pass %s \r\n", pa.pass);
SendCommandData (outbuffer, &sClient);
GetCommandData (&inbuffer, &sClient, "\r\n");
printf ("-><-%s\n", inbuffer);
free(inbuffer);
sprintf (outbuffer, "stat \r\n", pa.user);
SendCommandData (outbuffer, &sClient);
GetCommandData (&inbuffer, &sClient, "\r\n");
printf ("-><-%s\n", inbuffer);
free(inbuffer);
if (pa.id == 1)
{
printf("Hit 1\n");
sprintf (outbuffer, "retr 1\r\n", pa.user);
printf("Hit 2\n");
SendCommandData (outbuffer, &sClient);
printf("Hit 3\n");
GetCommandData (&inbuffer, &sClient, "\r\n.\r\n");
printf("Hit 4\n");
printf ("%d\n%s\n", strlen (inbuffer), inbuffer);
free(inbuffer);
}
return POP3_SUCCESS;
}
But it is not printing the "hit 4 " print statment. And also when I am debugging it works . I am using VC6 on Winxp sp2. config data is stored in www.sqlite.org db. I am attaching the entire source with it for the reference.
thanks