mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-28 10:02:22 +02:00
Add multi recv to UdpReceiver
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <iostream>
|
||||
#include "UdpReceiver.hpp"
|
||||
#include "jungfrau.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -70,6 +70,11 @@ void UdpReceiver::bind(const uint16_t port, const size_t usec_timeout)
|
||||
sizeof(rcvbuf_n_bytes));
|
||||
}
|
||||
|
||||
int UdpReceiver::receive_many(mmsghdr* msgs, const size_t n_msgs)
|
||||
{
|
||||
return recvmmsg(socket_fd_, msgs, n_msgs, MSG_DONTWAIT, 0);
|
||||
}
|
||||
|
||||
bool UdpReceiver::receive(void* buffer, size_t buffer_n_bytes)
|
||||
{
|
||||
auto data_len = recv(socket_fd_, buffer, buffer_n_bytes, 0);
|
||||
@@ -97,4 +102,4 @@ void UdpReceiver::close()
|
||||
{
|
||||
::close(socket_fd_);
|
||||
socket_fd_ = -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user