MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / writeToFile

Method writeToFile

src/net/Ping.cpp:351–360  ·  view source on GitHub ↗

serialize packet to file -- note lack of error checking must write to a binary file if we use plain "pack"

Source from the content-addressed store, hash-verified

349// serialize packet to file -- note lack of error checking
350// must write to a binary file if we use plain "pack"
351void PingPacket::writeToFile(std::ostream& out) const {
352 if (!out) { return; }
353
354 char buffer[PingPacket::PacketSize];
355 void* buf = buffer;
356 buf = nboPackUInt16(buf, PingPacket::PacketSize - 4);
357 buf = nboPackUInt16(buf, MsgPingCodeReply);
358 buf = pack(buf, getServerVersion());
359 out.write(buffer, sizeof(buffer));
360}
361
362// de serialize packet from file
363// must read from a binary file if we use plain "unpack"

Callers

nothing calls this directly

Calls 3

nboPackUInt16Function · 0.85
getServerVersionFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected