TCP data socket.
More...
#include <TCPSocket.h>
TCP data socket.
A data socket using TCP.
◆ JobResult
Enumerator |
---|
Break | Break the Job chain.
|
Retry | Retry the same job.
|
New | Require a new job.
|
◆ TCPSocket() [1/4]
◆ TCPSocket() [2/4]
◆ TCPSocket() [3/4]
◆ TCPSocket() [4/4]
◆ ~TCPSocket()
TCPSocket::~TCPSocket |
( |
| ) |
|
|
override |
◆ bind()
Bind socket to address.
Binds the socket to a particular address.
Implements IDataSocket.
◆ close()
void TCPSocket::close |
( |
| ) |
|
|
overridevirtual |
Close socket.
Closes the socket. This should flush the output stream.
Reimplemented from IDataSocket.
◆ connect()
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.
Implements IDataSocket.
◆ discardWrittenData()
void TCPSocket::discardWrittenData |
( |
int | bytesWrote | ) |
|
|
protected |
◆ doRead()
◆ doWrite()
◆ flush()
void TCPSocket::flush |
( |
| ) |
|
|
overridevirtual |
Flush the stream.
Waits until all buffered data has been written to the stream.
Implements IDataSocket.
◆ getEvents()
◆ getEventTarget()
void * TCPSocket::getEventTarget |
( |
| ) |
const |
|
overridevirtual |
Get event target.
Returns the event target for events generated by this socket.
Reimplemented from IDataSocket.
◆ getMutex()
Mutex & TCPSocket::getMutex |
( |
| ) |
|
|
inlineprotected |
◆ getSize()
uint32_t TCPSocket::getSize |
( |
| ) |
const |
|
overridevirtual |
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 IDataSocket.
◆ getSocket()
◆ isConnected()
bool TCPSocket::isConnected |
( |
| ) |
const |
|
inlineprotected |
◆ isFatal()
bool TCPSocket::isFatal |
( |
| ) |
const |
|
overridevirtual |
◆ isReadable()
bool TCPSocket::isReadable |
( |
| ) |
const |
|
inlineprotected |
◆ isReady()
bool TCPSocket::isReady |
( |
| ) |
const |
|
overridevirtual |
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 IDataSocket.
◆ isWritable()
bool TCPSocket::isWritable |
( |
| ) |
const |
|
inlineprotected |
◆ newJob()
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ read()
uint32_t TCPSocket::read |
( |
void * | buffer, |
|
|
uint32_t | n ) |
|
overridevirtual |
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 IDataSocket.
◆ sendEvent()
◆ setConnected()
void TCPSocket::setConnected |
( |
bool | connected | ) |
|
|
inlineprotected |
◆ setJob()
◆ setReadable()
void TCPSocket::setReadable |
( |
bool | readable | ) |
|
|
inlineprotected |
◆ setWritable()
void TCPSocket::setWritable |
( |
bool | canWrite | ) |
|
|
inlineprotected |
◆ shutdownInput()
void TCPSocket::shutdownInput |
( |
| ) |
|
|
overridevirtual |
Shutdown input.
Shutdown the input side of the stream. Any pending input data is discarded and further reads immediately return 0.
Implements IDataSocket.
◆ shutdownOutput()
void TCPSocket::shutdownOutput |
( |
| ) |
|
|
overridevirtual |
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 IDataSocket.
◆ write()
void TCPSocket::write |
( |
const void * | buffer, |
|
|
uint32_t | n ) |
|
overridevirtual |
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 IDataSocket.
◆ m_events
◆ m_inputBuffer
◆ m_outputBuffer
The documentation for this class was generated from the following files: