WPILibC++ 2024.1.1-beta-4
raw_socket_istream.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#ifndef WPINET_RAW_SOCKET_ISTREAM_H_
6#define WPINET_RAW_SOCKET_ISTREAM_H_
7
8#include <wpi/raw_istream.h>
9
10namespace wpi {
11
12class NetworkStream;
13
15 public:
16 explicit raw_socket_istream(NetworkStream& stream, int timeout = 0)
17 : m_stream(stream), m_timeout(timeout) {}
18
19 void close() override;
20 size_t in_avail() const override;
21
22 private:
23 void read_impl(void* data, size_t len) override;
24
25 NetworkStream& m_stream;
26 int m_timeout;
27};
28
29} // namespace wpi
30
31#endif // WPINET_RAW_SOCKET_ISTREAM_H_
Definition: NetworkStream.h:13
Definition: raw_istream.h:22
Definition: raw_socket_istream.h:14
void close() override
raw_socket_istream(NetworkStream &stream, int timeout=0)
Definition: raw_socket_istream.h:16
size_t in_avail() const override
Definition: ntcore_cpp.h:26