18#ifndef _LOG4CXX_HELPERS_DATAGRAM_SOCKET_H
19#define _LOG4CXX_HELPERS_DATAGRAM_SOCKET_H
40 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(DatagramSocketPriv, m_priv)
53 virtual
void bind(
int lport, InetAddressPtr laddress) = 0;
59 virtual
void connect(InetAddressPtr address,
int port) = 0;
84 virtual
void receive(DatagramPacketPtr& p) = 0;
87 virtual
void send(DatagramPacketPtr& p) = 0;
91 static DatagramSocketUniquePtr
create();
95 static DatagramSocketUniquePtr
create(
int port);
99 static DatagramSocketUniquePtr
create(
int port, InetAddressPtr laddr);
This class represents a socket for sending and receiving datagram packets.
Definition datagramsocket.h:38
InetAddressPtr getLocalAddress() const
Gets the local address to which the socket is bound.
DatagramSocket(LOG4CXX_PRIVATE_PTR(DatagramSocketPriv) priv)
virtual void receive(DatagramPacketPtr &p)=0
Receives a datagram packet from this socket.
InetAddressPtr getInetAddress() const
Returns the address to which this socket is connected.
int getPort() const
Returns the port for this socket.
int getLocalPort() const
Returns the port number on the local host to which this socket is bound.
virtual bool isClosed() const =0
Returns wether the socket is closed or not.
virtual void bind(int lport, InetAddressPtr laddress)=0
Binds a datagram socket to a local port and address.
bool isConnected() const
Returns the connection state of the socket.
virtual void close()
Closes this datagram socket.
static DatagramSocketUniquePtr create()
Constructs a datagram socket and binds it to any available port on the local host machine.
virtual void send(DatagramPacketPtr &p)=0
Sends a datagram packet from this socket.
virtual void connect(InetAddressPtr address, int port)=0
Connects the socket to a remote address for this socket.
bool isBound() const
Returns the binding state of the socket.
base class for java-like objects.
Definition object.h:106
LOG4CXX_UNIQUE_PTR_DEF(DatagramSocket)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:158
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition object.h:39
#define END_LOG4CXX_CAST_MAP()
Definition object.h:152
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:146