mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-06-06 13:28:42 +02:00
Simple socket test
This commit is contained in:
+18
-12
@@ -47,11 +47,11 @@ int main (int argc, char *argv[]) {
|
||||
|
||||
auto ctx = zmq_ctx_new();
|
||||
auto socket = zmq_socket(ctx, ZMQ_PUSH);
|
||||
auto meta_socket = zmq_socket(ctx, ZMQ_PULL);
|
||||
//
|
||||
// if (zmq_setsockopt(meta_socket, ZMQ_SUBSCRIBE, nullptr, 0) != 0) {
|
||||
// throw runtime_error(strerror (errno));
|
||||
// }
|
||||
|
||||
|
||||
if (zmq_setsockopt(meta_socket, ZMQ_SUBSCRIBE, nullptr, 0) != 0) {
|
||||
throw runtime_error(strerror (errno));
|
||||
}
|
||||
|
||||
int status = 0;
|
||||
|
||||
@@ -70,16 +70,22 @@ int main (int argc, char *argv[]) {
|
||||
if (zmq_connect(socket, "ipc://writer") != 0) {
|
||||
throw runtime_error(strerror (errno));
|
||||
}
|
||||
|
||||
//TODO: Use ipc?
|
||||
if (zmq_connect(socket, "ipc://writer_meta") != 0) {
|
||||
|
||||
|
||||
auto meta_socket = zmq_socket(ctx, ZMQ_SUB);
|
||||
if (zmq_connect(socket, "ipc://metadata") != 0) {
|
||||
throw runtime_error(strerror (errno));
|
||||
}
|
||||
|
||||
cout << "receiving " << endl;
|
||||
uint64_t response;
|
||||
zmq_recv(meta_socket, &response, sizeof(response), 0);
|
||||
cout << "Done!! " << response << endl;
|
||||
if (zmq_setsockopt(meta_socket, ZMQ_SUBSCRIBE, "", 0) != 0) {
|
||||
throw runtime_error(strerror (errno));
|
||||
}
|
||||
while (true) {
|
||||
cout << "receiving " << endl;
|
||||
uint64_t response;
|
||||
zmq_recv(meta_socket, &response, sizeof(response), 0);
|
||||
cout << "Done!! " << response << endl;
|
||||
}
|
||||
|
||||
for (const auto& suffix:path_suffixes) {
|
||||
metadata_buffer->start_pulse_id = suffix.start_pulse_id;
|
||||
|
||||
Reference in New Issue
Block a user