Home · All Classes · alphabetical Classes List · Modules · Functions · |
QxtRPCPeer is a tool that encapsulates Qt signals and transmits them over a network connection. The signal is subsequently re-emitted on the receiving end of the connection.
QxtRPCPeer can operate in peer-to-peer mode (that is, one-to-one) or client-server (that is, one-to-many) mode. In peer or server mode, QxtRPCPeer can listen for and accept incoming connections. In peer or client mode, QxtRPCPeer can connect to a listening peer or server.
All data types used in attached signals and slots must be declared and registered with QMetaType using Q_DECLARE_METATYPE and qRegisterMetaType, and they must have stream operators registered with qRegisterMetaTypeStreamOperators.
The limits on the number of parameters passed to call() and related functions are a restriction of Qt, which limits parameters on a signal or slot to 10.
This enum is used with the setRPCType() to describe the role played in a connection. It is also returned by rpcType().
Creates a QxtRPCPeer object with the given parent.
Sets the RPC type.
Attempting to change the RPC type while listening or connected will be ignored with a warning.
Returns the current RPC type.
Connects to the specified peer or server on the selected port.
When the connection is complete, the peerConnected() signal will be emitted. If an error occurs, the peerError() signal will be emitted.
Listens on the specified interface on the specified port for connections.
Attempting to listen while in Client mode or while connected in Peer mode will be ignored with a warning. In Peer mode, only one connection can be active at a time. Additional incoming connections while connected to a peer will be dropped. When a peer connects, the peerConnected() signal will be emitted. In Server mode, multiple connections can be active at a time. Each client that connects will be provided a unique ID, included in the clientConnected() signal that will be emitted.
Disconnects from a server, client, or peer.
Servers must provide a client ID, provided by the clientConnected() signal; clients and peers must not.
Disconnects from all clients, or from the server or peer.
Stops listening for connections. Any connections still open will remain connected.
Returns a list of client IDs for all connected clients.
Attaches the given signal.
When the attached signal is emitted, it will be transmitted to all connected servers, clients, or peers. If an optional rpcFunction is provided, it will be used in place of the name of the transmitted signal. Use the SIGNAL() macro to specify the signal, just as you would for QObject::connect().
Attaches the given slot.
When a signal with the name given by rpcFunction is received from the network, the attached slot is executed. Use the SLOT() macro to specify the slot, just as you would for QObject::connect().
Detaches all signals and slots for the given object.
Sends the signal fn with the given parameter list to the server or peer.
This function accepts up to 9 QVariant parameters.
The receiver is not obligated to act upon the signal. If no server or peer is connected, the call is ignored. In particular, this function does nothing in Server mode.
Sends the signal with the given parameter list to the provided list of clients.
This function accepts up to 8 QVariant parameters.
The receivers are not obligated to act upon the signal. If no client is connected with a provided ID, the ID is ignored with a warning.
Sends the signal fn with the given parameter list to the specified client.
This function accepts up to 8 QVariant parameters.
The receiver is not obligated to act upon the signal. If no client with the given ID is connected, the call will be ignored with a warning.
Sends the signal fn with the given parameter list to all connected clients except for the client specified.
This function accepts up to 8 QVariant parameters.
The receiver is not obligated to act upon the signal. This function is useful for rebroadcasting a signal from one client to all other connected clients.
Detaches all signals and slots for the object that emitted the signal connected to detachSender().
This signal is emitted after a successful connection to or from a peer or server.
This signal is emitted after a successful connection from a client.
The given ID is used for disconnectPeer(), callClient(), and related functions.
This signal is emitted when a peer or server is disconnected.
This signal is emitted when a client disconnects. The given ID is no longer valid.
This signal is emitted whenever an error occurs on a socket.
Currently, no information about the socket that raised the error is available.
Serializes a signal into a form suitable for transmitting over the network.
Reimplement this function in a subclass to allow QxtRPCPeer to use a different protocol.
Deserializes network data into a signal name and a list of parameters.
Reimplement this function in a subclass to allow QxtRPCPeer to understand a different protocol. If you reimplement it, be sure to remove the processed portion of the data from the reference parameter. Return "qMakePair(QString(), QList<QVariant>())" if the deserialized data doesn't invoke a signal.
Indicates whether the data currently received from the network can be deserialized.
The default behavior of this function returns true if the buffer contains a newline character.
Reimplement this function in a subclass to allow QxtRPCPeer to understand a different protocol.
(c) 2007A.Picciani and A.Higerd LGPL | libqxt 0.2 |