lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Bld::Client Class Reference

Receives BLD multicast packets and returns their payloads one entry at a time; a packet whose source ID differs from getID() is dropped. More...

#include <Client.hh>

Public Member Functions

 Client (unsigned interface, unsigned mcaddr, unsigned port)
 Open a UDP socket with a 16 MiB receive buffer, bind it to mcaddr and port and join multicast group mcaddr on interface (addresses in host byte order).
 
 ~Client ()
 Free the packet buffer and close the socket.
 
void setID (unsigned v)
 Set the expected source ID.
 
unsigned getID () const
 Return the expected source ID.
 
uint64_t fetch (char *payload, unsigned sizeofT)
 Copy the next sizeofT-byte payload into payload and return its pulse ID (Header::pulseId() of the packet, plus the 12-bit offset for later entries).
 

Detailed Description

Receives BLD multicast packets and returns their payloads one entry at a time; a packet whose source ID differs from getID() is dropped.

Used by hpsBldClient, hpsBldStat and hpsBldCopy in psdaq/app.

Constructor & Destructor Documentation

◆ Client()

Pds::Bld::Client::Client ( unsigned  interface,
unsigned  mcaddr,
unsigned  port 
)

Open a UDP socket with a 16 MiB receive buffer, bind it to mcaddr and port and join multicast group mcaddr on interface (addresses in host byte order).

Throws a std::string on failure; the expected ID is not initialized.

◆ ~Client()

Pds::Bld::Client::~Client ( )

Free the packet buffer and close the socket.

Member Function Documentation

◆ fetch()

uint64_t Pds::Bld::Client::fetch ( char *  payload,
unsigned  sizeofT 
)

Copy the next sizeofT-byte payload into payload and return its pulse ID (Header::pulseId() of the packet, plus the 12-bit offset for later entries).

Receives a new packet when the current one has no complete entry left; returns 0 if that packet's ID differs from getID() and exits the process on a receive error.

◆ getID()

unsigned Pds::Bld::Client::getID ( ) const
inline

Return the expected source ID.

◆ setID()

void Pds::Bld::Client::setID ( unsigned  v)
inline

Set the expected source ID.


The documentation for this class was generated from the following file: