|
sender 부분
////////////////////// 보내도 된다는 준비받는 //////////////////////////////
Token tToken;
char szStart[1024];
nbytes = recv(hFileSock , szStart , 512 ,0 );
szStart[nbytes] = 0;
String strSt = tToken.FrontToken(szStart,"|");
while(1){
nbytes = fread(fileBuf, sizeof(char), BUFSIZE, fp);
send(hFileSock, fileBuf, nbytes, 0);
Sleep(5);
if(feof(fp))
break;
}
recv 부분
if( (fp=fopen(strFileName.c_str() , "wb")) == NULL)
{
ShowMessage("FileOpen Error");
return -1;
}
INT64 nBytes = 0;
int nsize = 0;
String strStart = "Start|";
/////////////////////// 받을 준비 되어있다는 /////////////////////////////
int nSend = send(hSock , strStart.c_str() , strStart.Length() , 0);
char szFileBuf[1024] = {'\0'};
while((nBytes = recv(hSock , szFileBuf , 1024 , 0)) != 0)
{
if(nBytes == -1)
break;
fwrite(szFileBuf , sizeof(char) , nBytes , fp);
nsize += nBytes;
}
fclose(fp);
이런식으로 했는데 브레이크 포인터로 하나하나 천천히 하면 파일이 받아지지만 그냥 실행시 파일 전송이 잘이루어 지지가 않내요 ....
|