我想通过 TCP 连接将数据流存储到大数组中,我该怎么做?
我的代码:
int iResult, count;
int recvbuflen = 512;
char buff[4096]={0};
char recvbuf[512] = {0};
.................
count = 0;
do {
iResult = recv(ClientSocket, recvbuf, recvbuflen, 0);
if (iResult > 0) {
count+=iResult;
//code to store in the buff[] array until reach to 4096 byte
//that's what i need
//for example: each time bind or add the recvbuf[] array at
//the end of buff[] array until reach to 4096 byte.
if(count == 4096)
{
//do the next process
count = 0;
}
}
}while(iResult > 0);
任何帮助。