#include <UdpSwitch.h> [code]
Inherits QObject.
Inheritance diagram for Protocols::Transports::UdpSwitch:


This class works in conjunction with a UdpConnection. All data written or read to or from a UdpConnection flows through its associated UdpSwitch. UdpSwitch allows a single UDP socket to be used to comunicate with multiple peers.
Depending on how you start() the switch, you can be nofiied when new incoming connections are detected.
Definition at line 44 of file UdpSwitch.h.
Signals | |
| void | connectionAccepted (UdpConnection *) |
Public Member Functions | |
| UdpSwitch () | |
| ~UdpSwitch () | |
| bool | start (const NodeAddress &switchAddress, bool acceptIncommingConnection) |
| Starts the switch by binding a socket to the given address. | |
| void | stop () |
Protected Member Functions | |
| bool | openChannel (UdpConnection *udpConnection, const NodeAddress &nodeAddress) |
| void | closeChannel (UdpConnection *udpConnection) |
| bool | writeDatagram (UdpConnection *udpConnection, const char *data, qint64 maxSize) |
Private Slots | |
| void | readyRead () |
Private Member Functions | |
| UdpSwitch (const UdpSwitch &) | |
| UdpSwitch & | operator= (const UdpSwitch &) |
Private Attributes | |
| UdpSwitchPrivate * | p |
Friends | |
| class | UdpConnection |
|
|
|
|
|
Definition at line 66 of file UdpSwitch.cpp. |
|
|
Definition at line 72 of file UdpSwitch.cpp. |
|
|
Definition at line 127 of file UdpSwitch.cpp. |
|
|
|
|
||||||||||||
|
Definition at line 113 of file UdpSwitch.cpp. |
|
|
|
|
|
Definition at line 151 of file UdpSwitch.cpp. |
|
||||||||||||
|
Starts the switch by binding a socket to the given address. This fucntion tries to bind a QUdpSocket at the specified switchAddress. It returns true on success and false on failure. The argument acceptIncomingConnections specifies whether a new UdpConnection should be created when a packet from yet unseen address is received. If you specify false, such packets will be simply discarded. If you specidy true, then a new UdpConnection will be created and the read datagram buffered there. Make sure that you connect the signal connectionAccepted(UdpConnection *) to some slot. The receiver of the signal gains ownership of the new UdpConnection object. If you fail to connect the signal and acceptIncomingConnections is true, then some resouced will be leaked. Definition at line 93 of file UdpSwitch.cpp. |
|
|
Definition at line 103 of file UdpSwitch.cpp. |
|
||||||||||||||||
|
Definition at line 136 of file UdpSwitch.cpp. |
|
|
Definition at line 71 of file UdpSwitch.h. |
|
|
Definition at line 69 of file UdpSwitch.h. |