blob: 91bcc1fae28a17a17b2de8e7b5977df1148f427b [file] [log] [blame]
Brian Silvermanf7bd1c22015-12-24 16:07:11 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2015. 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 NT_RAW_SOCKET_ISTREAM_H_
9#define NT_RAW_SOCKET_ISTREAM_H_
10
11#include "raw_istream.h"
12
13#include "tcpsockets/NetworkStream.h"
14
15namespace nt {
16
17class raw_socket_istream : public raw_istream {
18 public:
19 raw_socket_istream(NetworkStream& stream, int timeout = 0)
20 : m_stream(stream), m_timeout(timeout) {}
21 virtual ~raw_socket_istream() = default;
22 virtual bool read(void* data, std::size_t len);
23 virtual void close();
24
25 private:
26 NetworkStream& m_stream;
27 int m_timeout;
28};
29
30} // namespace nt
31
32#endif // NT_RAW_SOCKET_ISTREAM_H_