Apache log4cxx  Version 0.12.1
log4cxx::helpers::DatagramSocket Class Reference

This class represents a socket for sending and receiving datagram packets. More...

#include <datagramsocket.h>

Inheritance diagram for log4cxx::helpers::DatagramSocket:
log4cxx::helpers::Object

Public Member Functions

 DatagramSocket ()
 Constructs a datagram socket and binds it to any available port on the local host machine. More...
 
 DatagramSocket (int port)
 Constructs a datagram socket and binds it to the specified port on the local host machine. More...
 
 DatagramSocket (int port, InetAddressPtr laddr)
 Creates a datagram socket, bound to the specified local address. More...
 
 ~DatagramSocket ()
 ensure the socket is closed. More...
 
void bind (int lport, InetAddressPtr laddress)
 Binds a datagram socket to a local port and address. More...
 
void create ()
 Creates a datagram socket. More...
 
void close ()
 Closes this datagram socket. More...
 
void connect (InetAddressPtr address, int port)
 Connects the socket to a remote address for this socket. More...
 
InetAddressPtr getInetAddress () const
 Returns the address to which this socket is connected. More...
 
InetAddressPtr getLocalAddress () const
 Gets the local address to which the socket is bound. More...
 
int getLocalPort () const
 Returns the port number on the local host to which this socket is bound. More...
 
int getPort () const
 Returns the port for this socket. More...
 
bool isBound () const
 Returns the binding state of the socket. More...
 
bool isClosed () const
 Returns wether the socket is closed or not. More...
 
bool isConnected () const
 Returns the connection state of the socket. More...
 
void receive (DatagramPacketPtr &p)
 Receives a datagram packet from this socket. More...
 
void send (DatagramPacketPtr &p)
 Sends a datagram packet from this socket. More...
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Detailed Description

This class represents a socket for sending and receiving datagram packets.

Constructor & Destructor Documentation

◆ DatagramSocket() [1/3]

log4cxx::helpers::DatagramSocket::DatagramSocket ( )

Constructs a datagram socket and binds it to any available port on the local host machine.

◆ DatagramSocket() [2/3]

log4cxx::helpers::DatagramSocket::DatagramSocket ( int  port)

Constructs a datagram socket and binds it to the specified port on the local host machine.

◆ DatagramSocket() [3/3]

log4cxx::helpers::DatagramSocket::DatagramSocket ( int  port,
InetAddressPtr  laddr 
)

Creates a datagram socket, bound to the specified local address.

◆ ~DatagramSocket()

log4cxx::helpers::DatagramSocket::~DatagramSocket ( )

ensure the socket is closed.

Member Function Documentation

◆ bind()

void log4cxx::helpers::DatagramSocket::bind ( int  lport,
InetAddressPtr  laddress 
)

Binds a datagram socket to a local port and address.

◆ close()

void log4cxx::helpers::DatagramSocket::close ( )

Closes this datagram socket.

◆ connect()

void log4cxx::helpers::DatagramSocket::connect ( InetAddressPtr  address,
int  port 
)

Connects the socket to a remote address for this socket.

◆ create()

void log4cxx::helpers::DatagramSocket::create ( )

Creates a datagram socket.

◆ getInetAddress()

InetAddressPtr log4cxx::helpers::DatagramSocket::getInetAddress ( ) const
inline

Returns the address to which this socket is connected.

◆ getLocalAddress()

InetAddressPtr log4cxx::helpers::DatagramSocket::getLocalAddress ( ) const
inline

Gets the local address to which the socket is bound.

◆ getLocalPort()

int log4cxx::helpers::DatagramSocket::getLocalPort ( ) const
inline

Returns the port number on the local host to which this socket is bound.

◆ getPort()

int log4cxx::helpers::DatagramSocket::getPort ( ) const
inline

Returns the port for this socket.

◆ isBound()

bool log4cxx::helpers::DatagramSocket::isBound ( ) const
inline

Returns the binding state of the socket.

◆ isClosed()

bool log4cxx::helpers::DatagramSocket::isClosed ( ) const
inline

Returns wether the socket is closed or not.

◆ isConnected()

bool log4cxx::helpers::DatagramSocket::isConnected ( ) const
inline

Returns the connection state of the socket.

◆ receive()

void log4cxx::helpers::DatagramSocket::receive ( DatagramPacketPtr &  p)

Receives a datagram packet from this socket.

◆ send()

void log4cxx::helpers::DatagramSocket::send ( DatagramPacketPtr &  p)

Sends a datagram packet from this socket.


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