CCIMXDesktop
 
Loading...
Searching...
No Matches
PeerConnection Class Reference

socket positive More...

#include <PeerConnection.h>

Inheritance diagram for PeerConnection:

Public Types

enum class  ConnectionState { Disconnected , Listening , Connecting , Connected }
 Defines the current state of the peer connection. More...
 

Signals

void stateChanged (PeerConnection::ConnectionState state)
 Emitted when the connection state changes.
 
void connected ()
 Emitted when a connection is successfully established.
 
void disconnected ()
 Emitted when the connection is terminated.
 
void dataReceived (const QByteArray &data)
 Emitted when data is received from the peer.
 
void bytesWritten (qint64 bytesWritten)
 Emitted to report the result of a send operation.
 
void errorOccurred (QAbstractSocket::SocketError socketError)
 Emitted when a network error occurs.
 

Public Member Functions

 Q_ENUM (ConnectionState)
 
 PeerConnection (QObject *parent)
 
 Q_DISABLE_COPY_MOVE (PeerConnection)
 
bool availableSelfListen (const SelfInfo &info)
 listen for the P2P available
 
bool connectToPeer (const PeerInfo &peerInfo)
 
SelfInfo selfInfo () const
 
PeerInfo peerInfo () const
 Gets the information of the connected remote peer.
 
ConnectionState state () const
 Returns the current state of the connection.
 
bool send_data (const QByteArray &raw_data)
 Asynchronously sends data to the connected peer.
 
void disconnectFromPeer ()
 Closes the current connection and stops listening. Resets the object to its initial state.
 
const QString uuid () const
 get the only one uuid
 

Detailed Description

socket positive

Member Enumeration Documentation

◆ ConnectionState

Defines the current state of the peer connection.

Enumerator
Disconnected 

No active connection.

Listening 

Listening for an incoming connection.

Connecting 

Attempting to connect to a peer.

Connected 

An active connection is established.

Member Function Documentation

◆ bytesWritten

void PeerConnection::bytesWritten ( qint64  bytesWritten)
signal

Emitted to report the result of a send operation.

Parameters
bytesWrittenThe number of bytes successfully written to the socket.

◆ dataReceived

void PeerConnection::dataReceived ( const QByteArray &  data)
signal

Emitted when data is received from the peer.

Parameters
dataThe data received.

◆ errorOccurred

void PeerConnection::errorOccurred ( QAbstractSocket::SocketError  socketError)
signal

Emitted when a network error occurs.

Parameters
socketErrorThe specific error code.

◆ peerInfo()

PeerInfo PeerConnection::peerInfo ( ) const

Gets the information of the connected remote peer.

Returns
A PeerInfo object for the connected peer. Returns an invalid object if not connected.

◆ send_data()

bool PeerConnection::send_data ( const QByteArray &  raw_data)

Asynchronously sends data to the connected peer.

Parameters
dataThe QByteArray data to send.
Returns
True if the data was queued for sending, false if there is no active connection.

◆ stateChanged

void PeerConnection::stateChanged ( PeerConnection::ConnectionState  state)
signal

Emitted when the connection state changes.

Parameters
stateThe new state of the connection.

◆ uuid()

const QString PeerConnection::uuid ( ) const
inline

get the only one uuid

Returns

The documentation for this class was generated from the following files: