trantor
Non-blocking I/O cross-platform TCP network library, using C++14
Loading...
Searching...
No Matches
AsyncStream.h
Go to the documentation of this file.
1
14
15#pragma once
16
18#include <memory>
19
20namespace trantor
21{
27class TRANTOR_EXPORT AsyncStream : public NonCopyable
28{
29 public:
30 virtual ~AsyncStream() = default;
40 virtual bool send(const char *data, size_t len) = 0;
41 bool send(const std::string &data)
42 {
43 return send(data.data(), data.length());
44 }
48 virtual void close() = 0;
49};
50using AsyncStreamPtr = std::unique_ptr<AsyncStream>;
51} // namespace trantor
This class represents a data stream that can be sent asynchronously. The data is sent in chunks,...
Definition AsyncStream.h:28
virtual void close()=0
Terminate the stream.
virtual bool send(const char *data, size_t len)=0
Send data asynchronously.
Definition EventLoop.h:34