Hello Debarshi, * Debarshi Ray wrote on Tue, Aug 19, 2008 at 05:29:28AM CEST: > > *buffer = realloc (*buffer, *size); > > Oops, I meant to use xrealloc there.
FWIW, your current algorithm of adding BUFSIZ to size causes nonlinear amount of work done in realloc, for reading large files. You might want to increase memory by a constant factor or BUFSIZ, whichever is larger (e.g., just like read-file does), and thus less often than you recv. Cheers, Ralf