EthernetClient class
Definition at line 43 of file EthernetClient.h.
#include <EthernetClient.h>
◆ EthernetClient()
EthernetClient::EthernetClient |
( |
int |
sock | ) |
|
|
explicit |
◆ available()
virtual int EthernetClient::available |
( |
| ) |
|
|
virtual |
Returns the number of bytes available for reading.
- Returns
- number of bytes available.
◆ connect() [1/2]
virtual int EthernetClient::connect |
( |
const char * |
host, |
|
|
uint16_t |
port |
|
) |
| |
|
virtual |
Initiate a connection with host:port.
- Parameters
-
host | name to resolve or a stringified dotted IP address. |
port | to connect to. |
- Returns
- 1 if SUCCESS or -1 if FAILURE.
◆ connect() [2/2]
virtual int EthernetClient::connect |
( |
IPAddress |
ip, |
|
|
uint16_t |
port |
|
) |
| |
|
virtual |
Initiate a connection with ip:port.
- Parameters
-
ip | to connect to. |
port | to connect to. |
- Returns
- 1 if SUCCESS or -1 if FAILURE.
◆ connected()
virtual uint8_t EthernetClient::connected |
( |
| ) |
|
|
virtual |
Whether or not the client is connected.
Note that a client is considered connected if the connection has been closed but there is still unread data.
- Returns
- 1 if the client is connected, 0 if not.
◆ getSocketNumber()
int EthernetClient::getSocketNumber |
( |
| ) |
|
Get the internal socket file descriptor.
- Returns
- an integer, that is the socket number.
◆ operator bool()
virtual EthernetClient::operator bool |
( |
| ) |
|
|
virtual |
Overloaded cast operators.
Allow EthernetClient objects to be used where a bool is expected.
◆ operator!=() [1/2]
virtual bool EthernetClient::operator!= |
( |
const bool |
value | ) |
|
|
inlinevirtual |
◆ operator!=() [2/2]
◆ operator==() [1/2]
virtual bool EthernetClient::operator== |
( |
const bool |
value | ) |
|
|
inlinevirtual |
◆ operator==() [2/2]
Overloaded cast operators.
◆ peek()
virtual int EthernetClient::peek |
( |
| ) |
|
|
virtual |
Returns the next byte of the read queue without removing it from the queue.
- Returns
- -1 if no data, else the first byte of incoming data available.
◆ read() [1/2]
virtual int EthernetClient::read |
( |
| ) |
|
|
virtual |
Read a byte.
- Returns
- -1 if no data, else the first byte available.
◆ read() [2/2]
virtual int EthernetClient::read |
( |
uint8_t * |
buf, |
|
|
size_t |
bytes |
|
) |
| |
|
virtual |
Read a number of bytes and store in a buffer.
- Parameters
-
buf | buffer to write to. |
bytes | number of bytes to read. |
- Returns
- -1 if no data or number of read bytes.
◆ status()
uint8_t EthernetClient::status |
( |
| ) |
|
Connection status.
- Returns
- state according to W5100 library codes.
◆ stop()
virtual void EthernetClient::stop |
( |
| ) |
|
|
virtual |
Close the connection gracefully.
Send a FIN and wait 1s for a response. If no response close it forcefully.
◆ write() [1/4]
size_t EthernetClient::write |
( |
const char * |
buffer, |
|
|
size_t |
size |
|
) |
| |
Write at most 'size' characters.
- Parameters
-
buffer | to read from. |
size | of the buffer. |
- Returns
- 0 if FAILURE or the number of characters sent.
◆ write() [2/4]
size_t EthernetClient::write |
( |
const char * |
str | ) |
|
Write a null-terminated string.
- Parameters
-
- Returns
- 0 if FAILURE or number of characters sent.
◆ write() [3/4]
virtual size_t EthernetClient::write |
( |
const uint8_t * |
buf, |
|
|
size_t |
size |
|
) |
| |
|
virtual |
Write at most 'size' bytes.
- Parameters
-
buf | Buffer to read from. |
size | of the buffer. |
- Returns
- 0 if FAILURE or the number of bytes sent.
◆ write() [4/4]
virtual size_t EthernetClient::write |
( |
uint8_t |
b | ) |
|
|
virtual |
Write a byte.
- Parameters
-
- Returns
- 0 if FAILURE or 1 if SUCCESS.
The documentation for this class was generated from the following file: