This class can be used to discover GCF::IpcServer instances on LAN. More...
Signals | |
void | foundServer (const GCF::IpcServerInfo &info) |
Public Member Functions | |
IpcServerDiscovery (QObject *parent=0) | |
~IpcServerDiscovery () | |
GCF::Result | start (quint16 port=0) |
GCF::Result | stop () |
QList< GCF::IpcServerInfo > | foundServers () const |
void | releaseFoundServer (const GCF::IpcServerInfo &info) |
void | releaseAllFoundServers () |
Static Public Member Functions | |
static QString | user () |
Detailed Description
You can create an instance of this class in your application and invoke the start() method to begin looking for GCF::IpcServer instances in other applications on the LAN that are open and listening. Everytime such a server is found, this class emits a foundServer() signal. You can get a list of all found servers by calling foundServers(). Once the foundServer() signal is emitted for a particular server, it wont be emitted again for the same server. You can force the emission by removing the server from the list of found servers using the releaseFoundServer() method. Of release information about all found servers by calling the releaseAllFoundServers() method.
- Note
- You can only discover GCF::IpcServer instances in those applications that also have an instance of this class started on the same port.
Constructor & Destructor Documentation
GCF::IpcServerDiscovery::IpcServerDiscovery | ( | QObject * | parent = 0 | ) |
Constructor.
- Parameters
-
parent a QObject
parent to which this object will become a child
GCF::IpcServerDiscovery::~IpcServerDiscovery | ( | ) |
Destructor. Stops discovery before destroying itself.
Member Function Documentation
|
static |
- Returns
- user-name of this computer that will be broadcasted to other applications.
GCF::Result GCF::IpcServerDiscovery::start | ( | quint16 | port = 0 | ) |
This function starts the discovery process. It does two things
- Opens a UDP socket on the given
port
- Once in every 2 seconds, it broadcasts information about all GCF::IpcServer instances in this application.
- Begins listening for broadcast information packets sent by instances of this class in other applications opened on the same port.
GCF::Result GCF::IpcServerDiscovery::stop | ( | ) |
Stops discovering GCF::IpcServer instances and also stops broadcasting informtion about GCF::IpcServer instances in this application.
QList< GCF::IpcServerInfo > GCF::IpcServerDiscovery::foundServers | ( | ) | const |
- Returns
- a list of found servers
void GCF::IpcServerDiscovery::releaseFoundServer | ( | const GCF::IpcServerInfo & | info | ) |
Removes server-info (info
) from the list of found servers.
void GCF::IpcServerDiscovery::releaseAllFoundServers | ( | ) |
Removes all found server information.
|
signal |
This signal is emitted whenever this class detects the existence of a GCF::IpcServer on the LAN.