Skip to content

Instantly share code, notes, and snippets.

@silv3rm00n
Created December 22, 2011 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silv3rm00n/1509890 to your computer and use it in GitHub Desktop.
Save silv3rm00n/1509890 to your computer and use it in GitHub Desktop.
//Now receive the response
while( (read_size = recv(sock , buffer , sizeof(buffer) , 0) ) )
{
*response = realloc(*response , read_size + total_size);
memcpy(*response + total_size , buffer , read_size);
total_size += read_size;
}
*response = realloc(*response , total_size + 1);
*response[total_size] = '\0';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment