예제 #1
0
파일: server.cpp 프로젝트: cusnir/gocusp
				void sendMessage(const void* data, int size)
				{
					if (os.isValid() && ready) {
// 						printf("sendMessage()\n");
						ready = false;
						os.write(data, size, this);
					} else
						printf("sendMessage(): %s not ready!\n", remoteHost.keyStr().c_str());
				}
std::size_t DataRefInStream::read(OutStream& os, std::size_t len)
{
    auto size(std::min(mData.size() - mPosition, len));

    os.write(DataRef(mData.begin() + mPosition,
                     mData.begin() + mPosition + size));

    mPosition += size;

    return size;
}
예제 #3
0
 inline void WriteValue(OutStream& out, const Type& t)
 {
      out.write(reinterpret_cast<const char*>(&t), sizeof(Type));
 }