# SocketUDP Class Reference

`#include <SocketUDP.hh>`

Inheritance diagram for SocketUDP:

[legend]

List of all members.

## Public Member Functions
| SocketUDP ()
virtual | ~SocketUDP ()
virtual void | send (const unsigned char *, size_t) throw (NetworkError, NetworkSignal)
virtual void | receive (void *Message, unsigned long Size) throw (NetworkError, NetworkSignal)
virtual bool | isDataReady () const
int | returnSocket ()
virtual unsigned long | returnAdress () const
virtual void | close ()
virtual void | createConnection (const char *server_name, unsigned int port) throw (NetworkError)
| Create an UDP client.
void | createUDPServer (unsigned int port) throw (NetworkError, NetworkSignal)
| create an UDP server.
void | attach (int socket_ouvert, unsigned long Adresse, unsigned int port) throw (NetworkError, NetworkSignal)
unsigned int | getPort () const
unsigned long | getAddr () const
## Private Member Functions
void | setPort (unsigned int port)
int | bind ()
int | open ()
## Private Attributes
bool | PhysicalLink
| tak indicating physical or logical link
long | _socket_udp
struct sockaddr_in | sock_local
struct sockaddr_in | sock_source
char * | Addr_Source
unsigned int | Port_Source
struct sockaddr_in | sock_distant
struct hostent * | hp_distant
int | _sock_local_length
bool | _est_init_udp
ByteCount_t | SentBytesCount
ByteCount_t | RcvdBytesCount
unsigned long | BufferSize
char | Buffer [4096]

## Detailed Description

Definition at line 40 of file SocketUDP.hh.

## Constructor & Destructor Documentation

SocketUDP | ( |  | ) |

Definition at line 203 of file SocketUDP.cc.

References SocketUDP::_est_init_udp, SocketUDP::_socket_udp, SocketUDP::BufferSize, SocketUDP::hp_distant, SocketUDP::PhysicalLink, SocketUDP::RcvdBytesCount, and SocketUDP::SentBytesCount.

~SocketUDP | ( |  | ) | `[virtual]`

Definition at line 221 of file SocketUDP.cc.

References SocketUDP::_est_init_udp, SocketUDP::_socket_udp, SocketUDP::close(), SocketUDP::RcvdBytesCount, and SocketUDP::SentBytesCount.

Here is the call graph for this function:

## Member Function Documentation

void send | ( | const unsigned char * | Message,
|  | size_t | Size |
| ) |  |  | throw (NetworkError, NetworkSignal)`[virtual]`

Implements Socket.

Definition at line 247 of file SocketUDP.cc.

References SocketUDP::_est_init_udp, SocketUDP::_socket_udp, PrettyDebug::Out(), pdDebug, SocketUDP::SentBytesCount, and SocketUDP::sock_distant.

Here is the call graph for this function:

void receive | ( | void * | Message,
|  | unsigned long | Size |
| ) |  |  | throw (NetworkError, NetworkSignal)`[virtual]`

Implements Socket.

Definition at line 324 of file SocketUDP.cc.

References SocketUDP::_est_init_udp, SocketUDP::_socket_udp, SocketUDP::Buffer, BUFFER_MAXSIZE, SocketUDP::BufferSize, PrettyDebug::Out(), pdDebug, SocketUDP::RcvdBytesCount, and SocketUDP::sock_source.

Here is the call graph for this function:

bool isDataReady | ( |  | ) | const`[virtual]`

Return whether any data as already been read from the system socket and is waiting in the internal buffer.

Implements Socket.

Definition at line 306 of file SocketUDP.cc.

References SocketUDP::BufferSize.

Referenced by Communications::readMessage().

int returnSocket | ( |  | ) | `[virtual]`

Implements Socket.

Definition at line 381 of file SocketUDP.cc.

References SocketUDP::_socket_udp, PrettyDebug::Out(), and pdDebug.

Referenced by Communications::readMessage(), and SocketServer::setReferences().

Here is the call graph for this function:

unsigned long returnAdress | ( |  | ) | const`[virtual]`

Implements Socket.

Definition at line 371 of file SocketUDP.cc.

References SocketUDP::getAddr(), PrettyDebug::Out(), and pdDebug.

Here is the call graph for this function:

void close | ( |  | ) | `[virtual]`

Implements Socket.

Definition at line 267 of file SocketUDP.cc.

References SocketUDP::_est_init_udp, SocketUDP::_socket_udp, PrettyDebug::Out(), pdDebug, and SocketUDP::PhysicalLink.

Referenced by SocketServer::close(), RTIG::~RTIG(), SocketTuple::~SocketTuple(), and SocketUDP::~SocketUDP().

Here is the call graph for this function:

void createConnection | ( | const char * | server_name,
|  | unsigned int | port |
| ) |  |  | throw (NetworkError)`[virtual]`

Create an UDP client.

Implements Socket.

Definition at line 88 of file SocketUDP.cc.

Referenced by Communications::Communications().

void createUDPServer | ( | unsigned int | port | ) | throw (NetworkError, NetworkSignal)

create an UDP server.

Definition at line 157 of file SocketUDP.cc.

References MAXHOSTNAMELEN.

Referenced by RTIG::execute().

void attach | ( | int | socket_ouvert,
|  | unsigned long | Adresse,
|  | unsigned int | port |
| ) |  |  | throw (NetworkError, NetworkSignal)

Definition at line 52 of file SocketUDP.cc.

References PrettyDebug::Out(), and pdDebug.

Referenced by SocketServer::setReferences().

Here is the call graph for this function:

unsigned int getPort | ( |  | ) | const

Definition at line 295 of file SocketUDP.cc.

References PrettyDebug::Out(), pdDebug, and SocketUDP::sock_local.

Referenced by Communications::getPort().

Here is the call graph for this function:

unsigned long getAddr | ( |  | ) | const

Definition at line 287 of file SocketUDP.cc.

References PrettyDebug::Out(), pdDebug, and SocketUDP::sock_local.

Referenced by Communications::getAddress(), and SocketUDP::returnAdress().

Here is the call graph for this function:

void setPort | ( | unsigned int | port | ) | `[private]`

Definition at line 390 of file SocketUDP.cc.

References PrettyDebug::Out(), pdDebug, and SocketUDP::sock_local.

Here is the call graph for this function:

int bind | ( |  | ) | `[private]`

Definition at line 75 of file SocketUDP.cc.

References SocketUDP::_est_init_udp, SocketUDP::_socket_udp, and SocketUDP::sock_local.

int open | ( |  | ) | `[private]`

Definition at line 312 of file SocketUDP.cc.

References SocketUDP::_socket_udp.

## Member Data Documentation

bool PhysicalLink`[private]`

tak indicating physical or logical link

Definition at line 83 of file SocketUDP.hh.

Referenced by SocketUDP::close(), and SocketUDP::SocketUDP().

long _socket_udp`[private]`

Definition at line 88 of file SocketUDP.hh.

Referenced by SocketUDP::bind(), SocketUDP::close(), SocketUDP::open(), SocketUDP::receive(), SocketUDP::returnSocket(), SocketUDP::send(), SocketUDP::SocketUDP(), and SocketUDP::~SocketUDP().

struct sockaddr_in sock_local`[read, private]`

Definition at line 90 of file SocketUDP.hh.

Referenced by SocketUDP::bind(), SocketUDP::getAddr(), SocketUDP::getPort(), and SocketUDP::setPort().

struct sockaddr_in sock_source`[read, private]`

Definition at line 92 of file SocketUDP.hh.

Referenced by SocketUDP::receive().

char* Addr_Source`[private]`

Definition at line 93 of file SocketUDP.hh.

unsigned int Port_Source`[private]`

Definition at line 94 of file SocketUDP.hh.

struct sockaddr_in sock_distant`[read, private]`

Definition at line 95 of file SocketUDP.hh.

Referenced by SocketUDP::send().

struct hostent* hp_distant`[read, private]`

Definition at line 96 of file SocketUDP.hh.

Referenced by SocketUDP::SocketUDP().

int _sock_local_length`[private]`

Definition at line 98 of file SocketUDP.hh.

bool _est_init_udp`[private]`

Definition at line 99 of file SocketUDP.hh.

Referenced by SocketUDP::bind(), SocketUDP::close(), SocketUDP::receive(), SocketUDP::send(), SocketUDP::SocketUDP(), and SocketUDP::~SocketUDP().

ByteCount_t SentBytesCount`[private]`

Definition at line 101 of file SocketUDP.hh.

Referenced by SocketUDP::send(), SocketUDP::SocketUDP(), and SocketUDP::~SocketUDP().

ByteCount_t RcvdBytesCount`[private]`

Definition at line 102 of file SocketUDP.hh.

Referenced by SocketUDP::receive(), SocketUDP::SocketUDP(), and SocketUDP::~SocketUDP().

unsigned long BufferSize`[private]`

Definition at line 104 of file SocketUDP.hh.

Referenced by SocketUDP::isDataReady(), SocketUDP::receive(), and SocketUDP::SocketUDP().

char Buffer[4096]`[private]`

Definition at line 105 of file SocketUDP.hh.

Referenced by SocketUDP::receive().

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

- SocketUDP.hh
- SocketUDP.cc