trantor
Non-blocking I/O cross-platform TCP network library, using C++14
Toggle main menu visibility
Loading...
Searching...
No Matches
AsyncStream.h
Go to the documentation of this file.
1
14
15
#pragma once
16
17
#include <
trantor/utils/NonCopyable.h
>
18
#include <memory>
19
20
namespace
trantor
21
{
27
class
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
};
50
using
AsyncStreamPtr = std::unique_ptr<AsyncStream>;
51
}
// namespace trantor
NonCopyable.h
trantor::AsyncStream
This class represents a data stream that can be sent asynchronously. The data is sent in chunks,...
Definition
AsyncStream.h:28
trantor::AsyncStream::close
virtual void close()=0
Terminate the stream.
trantor::AsyncStream::send
virtual bool send(const char *data, size_t len)=0
Send data asynchronously.
trantor
Definition
EventLoop.h:34
trantor
net
AsyncStream.h
Generated by
1.17.0