WPILibC++  unspecified
raw_socket_istream.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_
9 #define WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_
10 
11 #include "support/raw_istream.h"
12 
13 namespace wpi {
14 
15 class NetworkStream;
16 
18  public:
19  explicit raw_socket_istream(NetworkStream& stream, int timeout = 0)
20  : m_stream(stream), m_timeout(timeout) {}
21 
22  void close() override;
23  size_t in_avail() const override;
24 
25  private:
26  void read_impl(void* data, size_t len) override;
27 
28  NetworkStream& m_stream;
29  int m_timeout;
30 };
31 
32 } // namespace wpi
33 
34 #endif // WPIUTIL_SUPPORT_RAW_SOCKET_ISTREAM_H_
Definition: NetworkStream.h:17
Definition: raw_socket_istream.h:17
Definition: SocketError.cpp:17
Definition: raw_istream.h:21