Hi all,
I want to make a simple POP3 client in C and Linux and I reached a dead end:
the responses from the POP3 server differ in length (eg: RETR x).
Is there a way to query the length of the TCP message before actually reading it so I can assign a buffer large enough to hold the data?
What I want to do is something similar to:
int length= ??? //message length
char *buffer=malloc(length)
buffer=read(...)
//processing the message
free(buffer)
(I found the MSG_PEEK option but from what I have read so far is doesn't seem like a good option; is there another way?)
Thank you