QcTransport Class
Frame-based, bidirectional link between one client and the server. More...
| Header: | #include <common/protocol/QcTransport.h> |
| Inherits: | QObject |
| Inherited By: |
Public Functions
| virtual void | close() = 0 |
| virtual QString | closeReason() const |
| virtual bool | closedByPeer() const |
| virtual bool | isOpen() const = 0 |
| virtual bool | keepsItsThread() const |
| virtual QString | peerAddress() const |
| virtual void | peerSaidGoodbye() |
| virtual qint64 | pendingBytes() const |
| virtual void | sendFrame(const QByteArray &frame) = 0 |
Signals
| void | closed() |
| void | frameReceived(const QByteArray &frame) |
Detailed Description
Implementations: in-process (single player, QcInProcessTransport) and TCP (QcTcpTransport). A transport may be used from the thread it lives in only.
Member Function Documentation
[pure virtual] void QcTransport::close()
Closes the link.
[virtual] QString QcTransport::closeReason() const
Returns why the transport closed itself (timeout, too slow, broken frame); empty otherwise.
[signal] void QcTransport::closed()
The link closed.
[virtual] bool QcTransport::closedByPeer() const
Returns whether the other end closed the link (without an error on this end); false while open and in-process.
[signal] void QcTransport::frameReceived(const QByteArray &frame)
A whole frame arrived from the other end.
[pure virtual] bool QcTransport::isOpen() const
Returns whether the link is open.
[virtual] bool QcTransport::keepsItsThread() const
Returns whether the transport must stay in the thread it was made in (moveToThread() would break it; a TLS socket, decision E-872). Whoever wants it in another thread makes it there.
[virtual] QString QcTransport::peerAddress() const
Returns where the other end is ("address:port"); empty in-process.
[virtual] void QcTransport::peerSaidGoodbye()
The other end said goodbye (its Disconnect arrived): this end may close at once and send its end without waiting for the other's (decision E-904).
[virtual] qint64 QcTransport::pendingBytes() const
Returns the bytes sent but not yet handed to the network (0 in-process); senders of bulk data hold back while a slow peer has much waiting.
[pure virtual] void QcTransport::sendFrame(const QByteArray &frame)
Sends frame to the other end.