用TransmitFile传输文件的问题
发送:
TransmitFile(clientFD, hFile, 0, 1024, NULL,NULL,NULL);
接收:
char sReceiveBuf[1024];
while(1)
{
memset(sReceiveBuf, 0, sizeof(sReceiveBuf));
ret = recv(clientFD, sReceiveBuf, sizeof(sReceiveBuf), 0);
if(ret == 0 || ret == SOCKET_ERROR)
{
printf( "SOCKET ERROR! ");
CloseHandle(hFile);
return;
}
//若为结束标志则退出循环
if( strncmp(sReceiveBuf, "Finished ", 8)==0 && ret==8 )
break;
bWriteRlt = WriteFile(hFile, (LPCVOID)sReceiveBuf, ret, &dwWritten, NULL);
//若写入文件错误则退出循环
if(bWriteRlt==FALSE)
break;
}
现在是传输到远程机器上可以,但从远程机器上下载却只能下载1k的内容
强人们指点啊
[解决办法]
你的结束标致是怎么得来的呢?你发送端的函数是怎么调用的