I'm using sockets with C++. The program simply requests an HTTP page, reads it into a buffer buf[512]
, and then displays the buffer. However pages can contain more data than the buffer, so it will cut off if there is no more space left. I can make the buffer size bigger, but that doesn't seem like a good solution. This is the code that I am using:
char buf[512];
int byte_count = recv(sockfd, buf, sizeof(buf), 0);
What would be an alternative to a char array in C++ to use as a buffer?