#include <cabal_udpsocket.h>
Inheritance diagram for Cabal::UDPSocket:
Public Member Functions | |
UDPSocket (const long timeout, const Address *local=0, const Address *remote=0) throw ( InitError ) | |
UDPSocket (const Address *local=0, const Address *remote=0) throw ( InitError ) | |
UDPSocket (const char *ip_local, const int port_local) throw ( InitError ) | |
UDPSocket (const char *ip_local, const int port_local, const char *ip_remote, const int port_remote) throw ( InitError ) | |
bool | setBroadcast () |
Requires broadcast for current socket. | |
int | sendTo (const void *data, const int count, const Address &remote) |
Sends a packet to a determined target. | |
int | recvFrom (void *data, const int count, Address &remote) |
Sends a packet to a determined target. | |
Protected Member Functions | |
virtual int | rawRecv (void *data, const int len) |
Subclasses hook to receive data. | |
virtual int | rawSend (const void *data, const int len) |
Subclasses hook to send data. |
This class encapsulates the behavior of an UDP (and so unconnected) socket. Most notably, it provides broadcast capability and datagram sending.
Definition at line 31 of file cabal_udpsocket.h.
|
Subclasses hook to receive data. This is called by recv() method to allow subclasses to specialize the job. All the preparation and error handling part are done by recv(), subclasses just need to implement this abstract method.
Implements Cabal::Socket. Definition at line 50 of file cabal_udpsocket.h. References Cabal::Address::varAddress(). |
|
Subclasses hook to send data. This is called by send() method to allow subclasses to specialize the job. All the preparation and error handling part are done by send(), subclasses just need to implement this abstract method.
Implements Cabal::Socket. Definition at line 60 of file cabal_udpsocket.h. References Cabal::Address::address(). |
|
Sends a packet to a determined target. This function works exactly as Socket::recv(), but it does not use the internally stored the remote address. Instead, it uses an address provided as a parameter. Definition at line 68 of file ltlib/cabal_udpsocket.cpp. References Cabal::Address::varAddress(). |
|
Sends a packet to a determined target. This function works exactly as Socket::send(), but it does not use the internally stored the remote address. Instead, it uses an address provided as a parameter. Definition at line 47 of file ltlib/cabal_udpsocket.cpp. References Cabal::Address::address(). |
|
Requires broadcast for current socket. This prepares the current UDP socket to send broadcast requests on its network. Usually, only locally bound sockets can be used to broadcast. The remote address of a broadcast socket can be a specific host or a network address. In the latter case, all the hosts in the target network will receive the packet.
Definition at line 35 of file ltlib/cabal_udpsocket.cpp. |