Connection base class.
More...
#include <Connection.h>
List of all members.
Detailed Description
Member Enumeration Documentation
Receive mode.
- Enumerator:
ReceiveAutomatic |
Data is received automatically (see OnReceive())
|
ReceiveManual |
Data is received manually (see Receive())
|
Constructor & Destructor Documentation
Member Function Documentation
Get host that owns this connection.
- Returns:
- Host
Get host that owns this connection.
- Returns:
- Host
Get name of connected host.
- Returns:
- Name of host
Get port.
- Returns:
- Port number
Get socket.
- Returns:
- The socket object
Get socket.
- Returns:
- The socket object
Check if connection is active.
- Returns:
- 'true' if the connection is currently established, else 'false'
Disconnect.
- Returns:
- 'true' if all went fine, else 'false' (maybe there's no connection established?)
Get receive mode.
- Returns:
- Receive mode
Set receive mode.
- Parameters:
-
[in] | nReceiveMode | Receive mode |
Send data.
- Parameters:
-
[in] | pBuffer | Data to send, if a null pointer nothing happens |
[in] | nSize | Size in bytes of the buffer to send, MUST be valid! |
- Returns:
- Total number of bytes sent. Can be less than the requested size to be sent, negative value on error
Send string.
- Parameters:
-
- Returns:
- Total number of bytes sent, negative value on error
Receives data (blocking request)
- Parameters:
-
[out] | pBuffer | Buffer that receives the data, if a null pointer, nothing can be received |
[in] | nSize | Size in bytes of the buffer that receives the data, MUST be valid! |
- Returns:
- Total number of received bytes, negative value on error
- Note:
- If there is currently not enough data available, this function will read as much as possible, meaning that less data can be read than requested
- If more data is waiting to be received as the given buffer is able to store, you have to call this method multiple times in order to gather all waiting data
Read line of text (blocking request)
- Returns:
- Line read
Establish a connection to a host by specifying address and port.
- Parameters:
-
[in] | sHost | Host name |
[in] | nPort | Port number |
- Returns:
- 'true' if all went fine, else 'false'
Establish a connection to a host by using a given socket.
- Parameters:
-
[in] | cSocket | Socket of the host to connect to |
- Returns:
- 'true' if all went fine, else 'false'
Called when the connection receives data.
- Parameters:
-
[in] | pBuffer | Buffer with the received data, a null pointer on terrible error |
[in] | nSize | Number of received bytes within the given buffer (always valid!) |
- Note:
- Do NOT keep a pointer/reference to 'nBuffer' because this buffer is only valid inside this function
Reimplemented in PLCore::HttpServerConnection, and PLCore::HttpClientConnection.
The documentation for this class was generated from the following files: