add network_io folder

This commit is contained in:
Bechir Braham
2024-04-03 16:40:00 +02:00
parent 9e96f8b150
commit f772434072
9 changed files with 54 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
set(EXAMPLE_LIST "json_example;logger_example;numpy_read_example;multiport_example;raw_example;zmq_example;")
set(EXAMPLE_LIST "${EXAMPLE_LIST};mythen_example;numpy_write_example")
set(EXAMPLE_LIST "json_example;logger_example;numpy_read_example;multiport_example;raw_example;")
set(EXAMPLE_LIST "${EXAMPLE_LIST};mythen_example;numpy_write_example;zmq_receiver_example;zmq_sender_example;")
foreach(example ${EXAMPLE_LIST})
add_executable(${example} ${example}.cpp)
target_link_libraries(${example} PUBLIC aare PRIVATE aare_compiler_flags)

View File

@@ -1,10 +1,10 @@
#include "aare/ZmqSocket.hpp"
#include "aare/ZmqSocketReceiver.hpp"
#include <fmt/core.h>
#include <string>
int main() {
std::string endpoint = "tcp://localhost:5555";
aare::ZmqSocket socket(endpoint);
aare::ZmqSocketReceiver socket(endpoint);
socket.connect();
char *data = new char[1024 * 1024 * 10];
aare::zmqHeader header;

View File

@@ -0,0 +1,16 @@
#include "aare/ZmqSocketReceiver.hpp"
#include <fmt/core.h>
#include <string>
int main() {
std::string endpoint = "tcp://localhost:5555";
aare::ZmqSocketReceiver socket(endpoint);
socket.connect();
char *data = new char[1024 * 1024 * 10];
aare::zmqHeader header;
while (true) {
int rc = socket.receive(header, reinterpret_cast<std::byte *>(data));
}
delete[] data;
return 0;
}