示例#1
0
void FileTransfer::PutFile::WriteMessage(Message& msg) const
{
  msg.AddHeader("FileName", _fname); // this should do all the time

  std::ifstream file(_path, std::ios::in | std::ios::binary);

  if (!file.is_open())
    throw std::runtime_error("Could not open file " + _path);

  char buffer[4096];
  while (!file.eof())
  {
    file.read(buffer, sizeof(buffer));
    msg.WriteData(buffer, file.gcount());
  }
}
示例#2
0
文件: Command.cpp 项目: jineshkj/OOD
 void WriteMessage(Message& msg) const
 {
   msg.AddHeader("Data", dat);
 }
示例#3
0
void TextSearch::SearchString::WriteMessage(Message& msg) const
{
  msg.AddHeader("SearchString", _str); // this should do all the time
  msg.AddHeader("NumJobs", _jobs);
}