Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BIAS::UDPClient Class Reference

class for receiving UDP packages More...

#include <NetworkComm/UDPClient.hh>

+ Collaboration diagram for BIAS::UDPClient:

Public Member Functions

char * GetServerAddr ()
 
void Init (int port, const char *bind_to_ip=NULL)
 
bool IsActive ()
 
void receive_loop ()
 
int start (int max_message_size, int number_of_message_buffers, UDPDataConsumer *uc, bool UseTCP=false)
 Start receiving UDP packages. More...
 
void stop ()
 Stop the running client thread. More...
 
 UDPClient ()
 
 ~UDPClient ()
 Destructor. More...
 

Protected Member Functions

void check_for_complete_message (int last_number, int frames_total)
 
void create_buffer_structure (unsigned int numbuffers)
 
void destroy_buffer_structure ()
 
int get_a_free_buffer ()
 

Protected Attributes

std::vector< message_frame_bufferBuffers_
 
char ** completed_message
 
bool has_ended_
 
bool is_active_
 
bool isMulticast_
 
struct sockaddr_in local_socket_address_
 
long message_counter
 
int number_of_package_buffers_
 
char * ServerAddr_
 
int socket_fd_
 
bool TCPinsteadOfUDP_
 
UDPDataConsumerudc
 

Detailed Description

class for receiving UDP packages

Author
Ingo Thomsen

Definition at line 37 of file UDPClient.hh.

Constructor & Destructor Documentation

UDPClient::UDPClient ( )

Definition at line 30 of file UDPClient.cc.

UDPClient::~UDPClient ( )

Destructor.

Definition at line 460 of file UDPClient.cc.

Member Function Documentation

void UDPClient::check_for_complete_message ( int  last_number,
int  frames_total 
)
protected

Definition at line 96 of file UDPClient.cc.

References BIAS::UDP_PACKAGE_SIZE.

void UDPClient::create_buffer_structure ( unsigned int  numbuffers)
protected
void UDPClient::destroy_buffer_structure ( )
protected

Definition at line 86 of file UDPClient.cc.

int UDPClient::get_a_free_buffer ( )
protected
char* BIAS::UDPClient::GetServerAddr ( )
inline

Definition at line 81 of file UDPClient.hh.

void UDPClient::Init ( int  port,
const char *  bind_to_ip = NULL 
)
Parameters
portWait for incoming UDP packages on this port
bind_to_ipbin to this IP, of NULL is given use any ip

Definition at line 46 of file UDPClient.cc.

bool BIAS::UDPClient::IsActive ( )
inline

Definition at line 79 of file UDPClient.hh.

void UDPClient::receive_loop ( )
int UDPClient::start ( int  max_message_size,
int  number_of_message_buffers,
UDPDataConsumer uc,
bool  UseTCP = false 
)

Start receiving UDP packages.

The is done in a seperated thread.

Author
Ingo Thomsen
Parameters
number_of_package_buffersHow UDP packages shall be buffered?
max_message_sizeThe maximum size of a completed message
number_of_message_buffersHow many messages can be buffered (at least 1). Therefore the allocated memory size is at least max_message_size * number_of_message_buffers !
ucThe UDPDataConsumer whose consume_complete_message()-method is called, when a message has been completed by this client.
Returns
-1 if there occurs an error before or while creating the thread and returns 0 otherwise

Definition at line 323 of file UDPClient.cc.

References BIAS::UDP_PACKAGE_SIZE.

void UDPClient::stop ( )

Stop the running client thread.

Author
Ingo Thomsen
Todo:
Leave the multicast group

Definition at line 429 of file UDPClient.cc.

Member Data Documentation

std::vector<message_frame_buffer> BIAS::UDPClient::Buffers_
protected

Definition at line 113 of file UDPClient.hh.

char** BIAS::UDPClient::completed_message
protected

Definition at line 91 of file UDPClient.hh.

bool BIAS::UDPClient::has_ended_
protected

Definition at line 103 of file UDPClient.hh.

bool BIAS::UDPClient::is_active_
protected

Definition at line 101 of file UDPClient.hh.

bool BIAS::UDPClient::isMulticast_
protected

Definition at line 98 of file UDPClient.hh.

struct sockaddr_in BIAS::UDPClient::local_socket_address_
protected

Definition at line 106 of file UDPClient.hh.

long BIAS::UDPClient::message_counter
protected

Definition at line 87 of file UDPClient.hh.

int BIAS::UDPClient::number_of_package_buffers_
protected

Definition at line 122 of file UDPClient.hh.

char* BIAS::UDPClient::ServerAddr_
protected

Definition at line 119 of file UDPClient.hh.

int BIAS::UDPClient::socket_fd_
protected

Definition at line 109 of file UDPClient.hh.

bool BIAS::UDPClient::TCPinsteadOfUDP_
protected

Definition at line 123 of file UDPClient.hh.

UDPDataConsumer* BIAS::UDPClient::udc
protected

Definition at line 89 of file UDPClient.hh.


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