Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IDataSocket Class Referenceabstract

Data stream socket interface. More...

#include <IDataSocket.h>

Inheritance diagram for IDataSocket:
Collaboration diagram for IDataSocket:

Classes

class  ConnectionFailedInfo

Public Member Functions

 IDataSocket (const IEventQueue *events)
manipulators
virtual void connect (const NetworkAddress &)=0
 Connect socket.
void bind (const NetworkAddress &) override=0
 Bind socket to address.
void close () override
 Close socket.
void * getEventTarget () const override
 Get event target.
uint32_t read (void *buffer, uint32_t n) override=0
 Read from stream.
void write (const void *buffer, uint32_t n) override=0
 Write to stream.
void flush () override=0
 Flush the stream.
void shutdownInput () override=0
 Shutdown input.
void shutdownOutput () override=0
 Shutdown output.
bool isReady () const override=0
 Test if read() will succeed.
uint32_t getSize () const override=0
 Get bytes available to read.
virtual bool isFatal () const =0
Public Member Functions inherited from ISocket
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.
Public Member Functions inherited from deskflow::IStream
 IStream ()=default

Detailed Description

Data stream socket interface.

This interface defines the methods common to all network sockets that represent a full-duplex data stream.

Constructor & Destructor Documentation

◆ IDataSocket()

IDataSocket::IDataSocket ( const IEventQueue * events)
inlineexplicit

Member Function Documentation

◆ bind()

void IDataSocket::bind ( const NetworkAddress & )
overridepure virtual

Bind socket to address.

Binds the socket to a particular address.

Implements ISocket.

Implemented in TCPSocket.

◆ close()

void IDataSocket::close ( )
overridevirtual

Close socket.

Closes the socket. This should flush the output stream.

Implements ISocket.

Reimplemented in SecureSocket, and TCPSocket.

◆ connect()

virtual void IDataSocket::connect ( const NetworkAddress & )
pure virtual

Connect socket.

Attempt to connect to a remote endpoint. This returns immediately and sends a connected event when successful or a connection failed event when it fails. The stream acts as if shutdown for input and output until the stream connects.

Implemented in SecureSocket, and TCPSocket.

◆ flush()

void IDataSocket::flush ( )
overridepure virtual

Flush the stream.

Waits until all buffered data has been written to the stream.

Implements deskflow::IStream.

Implemented in TCPSocket.

◆ getEventTarget()

void * IDataSocket::getEventTarget ( ) const
overridevirtual

Get event target.

Returns the event target for events generated by this socket.

Implements ISocket.

Reimplemented in TCPSocket.

◆ getSize()

uint32_t IDataSocket::getSize ( ) const
overridepure virtual

Get bytes available to read.

Returns a conservative estimate of the available bytes to read (i.e. a number not greater than the actual number of bytes). Some streams may not be able to determine this and will always return zero.

Implements deskflow::IStream.

Implemented in TCPSocket.

◆ isFatal()

virtual bool IDataSocket::isFatal ( ) const
pure virtual

Implemented in SecureSocket, and TCPSocket.

◆ isReady()

bool IDataSocket::isReady ( ) const
overridepure virtual

Test if read() will succeed.

Returns true iff an immediate read() will return data. This may or may not be the same as getSize() > 0, depending on the stream type.

Implements deskflow::IStream.

Implemented in TCPSocket.

◆ read()

uint32_t IDataSocket::read ( void * buffer,
uint32_t n )
overridepure virtual

Read from stream.

Read up to n bytes into buffer, returning the number read (zero if no data is available or input is shutdown). buffer may be nullptr in which case the data is discarded.

Implements deskflow::IStream.

Implemented in TCPSocket.

◆ shutdownInput()

void IDataSocket::shutdownInput ( )
overridepure virtual

Shutdown input.

Shutdown the input side of the stream. Any pending input data is discarded and further reads immediately return 0.

Implements deskflow::IStream.

Implemented in TCPSocket.

◆ shutdownOutput()

void IDataSocket::shutdownOutput ( )
overridepure virtual

Shutdown output.

Shutdown the output side of the stream. Any buffered output data is discarded and further writes generate output error events. Use flush() before shutdownOutput() to send buffered output data.

Implements deskflow::IStream.

Implemented in TCPSocket.

◆ write()

void IDataSocket::write ( const void * buffer,
uint32_t n )
overridepure virtual

Write to stream.

Write n bytes from buffer to the stream. If this can't complete immediately it will block. Data may be buffered in order to return more quickly. A output error event is generated when writing fails.

Implements deskflow::IStream.

Implemented in TCPSocket.


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