From: Tim R. <ti...@pr...> - 2017-03-03 20:33:43
|
Aurquiel --- wrote: > > The function to write to a file > > void write_to_file(unsigned char *p) > { > > for (int i=0; i<1024-1;i++) > { > outfile<<p[i]; > } > > } > > But in the file i am see that i am loosing packets, because i must > recive packtes of 204 bytes inside packtes of 1024 bytes You are losing a byte at the packet boundaries because you are only writing 1023 bytes to the file. Your "for" loop is wrong. I suggest you replace that whole function with outfile.write( (char *)p, 1024 ); -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |