summaryrefslogtreecommitdiff
path: root/modules/io_codec
diff options
context:
space:
mode:
Diffstat (limited to 'modules/io_codec')
-rw-r--r--modules/io_codec/c++/io_peer.tmpl.hpp8
-rw-r--r--modules/io_codec/examples/peer_echo_client.cpp11
2 files changed, 15 insertions, 4 deletions
diff --git a/modules/io_codec/c++/io_peer.tmpl.hpp b/modules/io_codec/c++/io_peer.tmpl.hpp
index e1863fc..26793b1 100644
--- a/modules/io_codec/c++/io_peer.tmpl.hpp
+++ b/modules/io_codec/c++/io_peer.tmpl.hpp
@@ -103,14 +103,14 @@ streaming_io_peer<Incoming, Outgoing, Encoding,
return io_stream_->on_read_disconnected();
}
-template <typename Codec, typename Incoming, typename Outgoing, typename BufferT>
-std::pair<own<streaming_io_peer<Codec, Incoming, Outgoing, BufferT>>,
- conveyor<data<Incoming>>>
+template <typename Incoming, typename Outgoing, typename BufferT>
+std::pair<own<streaming_io_peer<Incoming, Outgoing, BufferT>>,
+ conveyor<data<Incoming,Encoding>>>
new_streaming_io_peer(own<async_io_stream> stream) {
auto caf =
new_conveyor_and_feeder<data<Incoming>>();
- return {heap<streaming_io_peer<Codec, Incoming, Outgoing, BufferT>>(
+ return {heap<streaming_io_peer<Incoming, Outgoing, BufferT>>(
std::move(caf.feeder), std::move(stream)),
std::move(caf.conveyor)};
}
diff --git a/modules/io_codec/examples/peer_echo_client.cpp b/modules/io_codec/examples/peer_echo_client.cpp
index ec8cf8d..e8c8f82 100644
--- a/modules/io_codec/examples/peer_echo_client.cpp
+++ b/modules/io_codec/examples/peer_echo_client.cpp
@@ -24,5 +24,16 @@ int main(){
auto& network = aio.io->get_network();
+ auto eo_addr = network.resolve_address(saw::echo_address, saw::echo_port).take();
+ if(eo_addr.is_error()){
+ return -1;
+ }
+ auto& addr = eo_addr.get_value();
+ saw::own<saw::async_io_stream> echo_stream = nullptr;
+
+ network.connect(*addr).then([&echo_stream](saw::own<saw::io_stream> client){
+ echo_stream = saw::heap<saw::async_io_stream>(std::move(client));
+ }).detach();
+
return 0;
}