GNU Radio 3.4.2 C++ API
gr_udp_sink Class Reference

Write stream to an UDP socket. More...

#include <gr_udp_sink.h>

Inheritance diagram for gr_udp_sink:

List of all members.

Public Member Functions

 ~gr_udp_sink ()
int payload_size ()
 return the PAYLOAD_SIZE of the socket
void connect (const char *host, unsigned short port)
 Change the connection to a new destination.
void disconnect ()
 Send zero-length packet (if eof is requested) then stop sending.
int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
 just like gr_block::general_work, only this arranges to call consume_each for you

Protected Member Functions

 gr_udp_sink (size_t itemsize, const char *host, unsigned short port, int payload_size, bool eof)
 UDP Sink Constructor.

Friends

gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize, const char *host, unsigned short port, int payload_size, bool eof)

Detailed Description

Write stream to an UDP socket.

Parameters:
itemsizeThe size (in bytes) of the item datatype
hostThe name or IP address of the receiving host; use NULL or None for no connection
portDestination port to connect to on receiving host
payload_sizeUDP payload size by default set to 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
eofSend zero-length packet on disconnect

Constructor & Destructor Documentation

gr_udp_sink::gr_udp_sink ( size_t  itemsize,
const char *  host,
unsigned short  port,
int  payload_size,
bool  eof 
) [protected]

UDP Sink Constructor.

Parameters:
itemsizeThe size (in bytes) of the item datatype
hostThe name or IP address of the receiving host; use NULL or None for no connection
portDestination port to connect to on receiving host
payload_sizeUDP payload size by default set to 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
eofSend zero-length packet on disconnect
gr_udp_sink::~gr_udp_sink ( )

Member Function Documentation

void gr_udp_sink::connect ( const char *  host,
unsigned short  port 
)

Change the connection to a new destination.

Parameters:
hostThe name or IP address of the receiving host; use NULL or None to break the connection without closing
portDestination port to connect to on receiving host

Calls disconnect() to terminate any current connection first.

void gr_udp_sink::disconnect ( )

Send zero-length packet (if eof is requested) then stop sending.

Zero-byte packets can be interpreted as EOF by gr_udp_source. Note that disconnect occurs automatically when the sink is destroyed, but not when its top_block stops.

int gr_udp_sink::payload_size ( ) [inline]

return the PAYLOAD_SIZE of the socket

int gr_udp_sink::work ( int  noutput_items,
gr_vector_const_void_star input_items,
gr_vector_void_star output_items 
) [virtual]

just like gr_block::general_work, only this arranges to call consume_each for you

The user must override work to define the signal processing code

Implements gr_sync_block.


Friends And Related Function Documentation

gr_udp_sink_sptr gr_make_udp_sink ( size_t  itemsize,
const char *  host,
unsigned short  port,
int  payload_size,
bool  eof 
) [friend]

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