nBuffer is from recv. I open it with the mode binary.
client:
if(std::string(nBuffer)=="FILE_DONE_DOWN")
{
std::cout<<"Finnished Downloading File: "<<this->Files_To_Update[0]<<'\n';
this->Files_To_Update.erase(this->Files_To_Update.begin());
if(this->Files_To_Update.size()>0)
{
std::cout<<"Downloading File: "<<this->Files_To_Update[0]<<'\n';
this->Send_Client(this->Files_To_Update[0]);
this->WriteToFile.open(this->Files_To_Update[0],this->WriteToFile.binary);
}
else
{
std::cout<<"Downloading Executable...\n";
this->Doing="DOWNLOAD_EXE";
this->Send_Client("EXE");
}
}
else
{
nBuffer[Size]='\0';
this->WriteToFile.write(nBuffer,Size);
this->Send_Client("OK");
std::cout<<nBuffer<<'\n';
}host:
if(SendFile.is_open())
{
char SendBuf[Buff_Size];
//SendFile.seekg(std::ios::beg+DoingAt*Buff_Size);
SendFile.read(SendBuf,Buff_Size);
APP.Send_Server(SendBuf,p);
DoingAt++;
if(SendFile.eof())
{
SendFile.close();
}
std::cout<<SendBuf<<'\n';
}
else
{
APP.Send_Server("FILE_DONE_DOWN",p);
DoingAt=0;
SendFile.close();
Doing="SEND_FILES";
}i dont know if this is right, nor if this is the right approach. i was sort of following this tutorial:
http://www.codeproje...threaded-TCP-se
but instead of using a CFile i just used a fstream.
Oh, and by files i mean .png,.wav,.ogg, etc.






