AvogadroApp
Loading...
Searching...
No Matches
LocalSocketConnection Class Reference

#include <localsocketconnection.h>

Inheritance diagram for LocalSocketConnection:
Connection

Public Member Functions

 LocalSocketConnection (QObject *parentObject, QLocalSocket *socket)
 LocalSocketConnection (QObject *parentObject, const QString &connectionString)
void open () override
void start () override
void close () override
bool isOpen () override
QString connectionString () const override
bool send (const PacketType &packet, const EndpointIdType &endpoint) override
void flush () override
Public Member Functions inherited from Connection
 Connection (QObject *parentObject=nullptr)

Additional Inherited Members

Signals inherited from Connection
void packetReceived (const Avogadro::RPC::PacketType &packet, const Avogadro::RPC::EndpointIdType &endpoint)
void disconnected ()

Detailed Description

Provides an implementation of Connection using QLocalSockets. Each instance of the class wraps a QLocalSocket.

<avogadro/rpc/localsocketconnection.h>

Constructor & Destructor Documentation

◆ LocalSocketConnection() [1/2]

LocalSocketConnection ( QObject * parentObject,
QLocalSocket * socket )
explicit

Constructor used by LocalSocketConnectionListener to create a new connection based on an existing QLocalSocket.

◆ LocalSocketConnection() [2/2]

LocalSocketConnection ( QObject * parentObject,
const QString & connectionString )
explicit

Constructor used by a client to connect to a server.

Member Function Documentation

◆ open()

void open ( )
overridevirtual

Opens the connection to the server.

Implements Connection.

◆ start()

void start ( )
overridevirtual

Start receiving messages on this connection.

Implements Connection.

◆ close()

void close ( )
overridevirtual

Close the underlying socket.

Implements Connection.

◆ isOpen()

bool isOpen ( )
overridevirtual
Returns
true if connection is open, false otherwise

Implements Connection.

◆ connectionString()

QString connectionString ( ) const
overridevirtual
Returns
The serverName from the underlying socket

Implements Connection.

◆ send()

bool send ( const PacketType & packet,
const EndpointIdType & endpoint )
overridevirtual

Send the packet on the connection to endpoint.

Implements Connection.

◆ flush()

void flush ( )
overridevirtual

Flush all pending messages to the other endpoint.

Implements Connection.