| 20 | { |
| 21 | |
| 22 | bool BasePipeServer::ReadFromSocket(uint8_t* packetData, uint32_t expectedLength) |
| 23 | { |
| 24 | // This is a blocking read until either expectedLength has been received or an error is detected. |
| 25 | long totalBytesRead = 0; |
| 26 | while (arm::pipe::numeric_cast<uint32_t>(totalBytesRead) < expectedLength) |
| 27 | { |
| 28 | long bytesRead = arm::pipe::Read(m_ClientConnection, packetData, expectedLength); |
| 29 | if (bytesRead < 0) |
| 30 | { |
| 31 | std::cerr << ": Failure when reading from client socket: " << strerror(errno) << std::endl; |
| 32 | return false; |
| 33 | } |
| 34 | if (bytesRead == 0) |
| 35 | { |
| 36 | std::cerr << ": EOF while reading from client socket." << std::endl; |
| 37 | return false; |
| 38 | } |
| 39 | totalBytesRead += bytesRead; |
| 40 | } |
| 41 | return true; |
| 42 | }; |
| 43 | |
| 44 | bool BasePipeServer::WaitForStreamMetaData() |
| 45 | { |