GNU Radio 3.2.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:
gr_sync_block gr_block gr_basic_block

List of all members.

Public Member Functions

 ~gr_udp_sink ()
bool open ()
 open a socket specified by the port and ip address info
void close ()
 Close current socket.
int payload_size ()
 return the PAYLOAD_SIZE of the socket
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 *src, unsigned short port_src, const char *dst, unsigned short port_dst, int payload_size)
 UDP Sink Constructor.

Friends

gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize, const char *src, unsigned short port_src, const char *dst, unsigned short port_dst, int payload_size)

Detailed Description

Write stream to an UDP socket.

Parameters:
itemsizeThe size (in bytes) of the item datatype
srcThe source address as either the host name or the 'numbers-and-dots' IP address
port_srcDestination port to bind to (0 allows socket to choose an appropriate port)
dstThe destination address as either the host name or the 'numbers-and-dots' IP address
port_dstDestination port to connect to
payload_sizeUDP payload size by default set to 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))

Constructor & Destructor Documentation

gr_udp_sink::gr_udp_sink ( size_t  itemsize,
const char *  src,
unsigned short  port_src,
const char *  dst,
unsigned short  port_dst,
int  payload_size 
) [protected]

UDP Sink Constructor.

Parameters:
itemsizeThe size (in bytes) of the item datatype
srcThe source address as either the host name or the 'numbers-and-dots' IP address
port_srcDestination port to bind to (0 allows socket to choose an appropriate port)
dstThe destination address as either the host name or the 'numbers-and-dots' IP address
port_dstDestination port to connect to
payload_sizeUDP payload size by default set to 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
gr_udp_sink::~gr_udp_sink ( )

Member Function Documentation

void gr_udp_sink::close ( )

Close current socket.

Shuts down read/write on the socket

bool gr_udp_sink::open ( )

open a socket specified by the port and ip address info

Opens a socket, binds to the address, and makes connectionless association over UDP. If any of these fail, the fuction retuns the error and exits.

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 *  src,
unsigned short  port_src,
const char *  dst,
unsigned short  port_dst,
int  payload_size 
) [friend]

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