IsolatedEthernet
Public Member Functions
IsolatedEthernet::UDP Class Reference

Replacement for UDP class to use Ethernet. More...

#include <IsolatedEthernet.h>

Inheritance diagram for IsolatedEthernet::UDP:
Stream Printable Print

Public Member Functions

 UDP ()
 Construct a new UDP object. This is safe as a globally constructed object.
 
virtual ~UDP ()
 Destroy the UDP object. This releases the socket (it allocated) and any buffers.
 
bool setBuffer (size_t buffer_size, uint8_t *buffer=NULL)
 Allocates a buffer for parsePacket(). Default is 512 if not specified. More...
 
void releaseBuffer ()
 Releases the current buffer, discarding any previously allocated memory. More...
 
virtual uint8_t begin (uint16_t port, network_interface_t nif=0)
 Initializes a UDP socket. More...
 
virtual void stop ()
 Disconnects this UDP socket.
 
virtual int sendPacket (const uint8_t *buffer, size_t buffer_size, IPAddress destination, uint16_t port)
 Sends an packet directly. You should use this method instead of beginPacket(), write(), and endPacket(). More...
 
virtual int sendPacket (const char *buffer, size_t buffer_size, IPAddress destination, uint16_t port)
 Sends an packet directly. You should use this method instead of beginPacket(), write(), and endPacket(). More...
 
virtual int receivePacket (uint8_t *buffer, size_t buf_size, system_tick_t timeout=0)
 Retrieves a packet directly. You should use this method instead of parsePacket(). More...
 
virtual int receivePacket (char *buffer, size_t buf_size, system_tick_t timeout=0)
 Retrieves a packet directly. You should use this method instead of parsePacket(). More...
 
virtual int beginPacket (IPAddress ip, uint16_t port)
 Begin writing a packet to the given destination. It is often better to use sendPacket() instead. More...
 
virtual int beginPacket (const char *host, uint16_t port)
 Begin writing a packet to the given destination. It is often better to use sendPacket() instead. More...
 
virtual size_t write (uint8_t)
 Writes to the currently open packet after a call to beginPacket(). More...
 
virtual size_t write (const uint8_t *buffer, size_t size)
 Writes to the currently open packet after a call to beginPacket(). More...
 
virtual int endPacket ()
 Sends the current buffered packet over the network and clears the buffer. More...
 
virtual int parsePacket (system_tick_t timeout=0)
 Reads a UDP packet into the packet buffer. You should use receivePacket instead. More...
 
virtual int available ()
 Get the number of bytes that can be read after parsePacket. More...
 
virtual int read ()
 Read a single byte from the read buffer. Available after parsePacket(). More...
 
virtual int read (unsigned char *buffer, size_t len)
 Reads multiple bytes. Available after parsePacket(). More...
 
virtual int read (char *buffer, size_t len)
 Reads multiple bytes. Available after parsePacket(). More...
 
virtual int peek ()
 Returns the next character that read() will return without consuming it. More...
 
virtual void flush ()
 Blocks until all data has been sent out. More...
 
void flush_buffer ()
 Discards the currently read packet from parsePacket().
 
const uint8_t * buffer () const
 Returns the buffer used by parsePacket() and beginPacket() More...
 
virtual IPAddress remoteIP ()
 Return the IP address of the other side of the connection. More...
 
virtual uint16_t remotePort ()
 Return the port number of the other side of the connection. More...
 
virtual size_t printTo (Print &p) const
 
int joinMulticast (const IPAddress &ip)
 Join a multicast network. More...
 
int leaveMulticast (const IPAddress &ip)
 Leave a multicast network. More...
 
bool isOpen (sock_handle_t sock)
 Returns true if the socket is currently open. Used internally. More...
 
sock_handle_t socket ()
 Returns the internal socket handle for this connection. More...
 
virtual size_t write (uint8_t c)=0
 Write a single byte to the stream or file. More...
 
size_t write (const char *str)
 Write a null-terminated c-string the stream or file. More...
 
virtual size_t write (const uint8_t *buffer, size_t size)
 Write a bytes specified by a buffer and length to the stream or file. More...
 
void setTimeout (system_tick_t timeout)
 Sets the read timeout (default: 1000 milliseconds) More...
 
bool find (char *target)
 Reads data from the stream until the target string is found. More...
 
bool find (char *target, size_t length)
 Reads data from the stream until the target string is found. More...
 
bool findUntil (char *target, char *terminator)
 Reads data from the stream until the target string is found or the terminator string is found. More...
 
bool findUntil (char *target, size_t targetLen, char *terminate, size_t termLen)
 Reads data from the stream until the target string is found or the terminator string is found. More...
 
long parseInt ()
 returns the first valid (long) integer value from the current position More...
 
float parseFloat ()
 returns the first valid float value from the current position More...
 
size_t readBytes (char *buffer, size_t length)
 Read chars from stream into buffer. More...
 
size_t readBytesUntil (char terminator, char *buffer, size_t length)
 Read chars from stream into buffer until the character terminator is found. More...
 
String readString ()
 Reads the remainder of the file into a string.
 
String readStringUntil (char terminator)
 Reads the remainder of the file into a string or until terminator is found. More...
 
int getWriteError ()
 Return the last error code. 0 means no error.
 
void clearWriteError ()
 Clear the last error code to 0.
 
size_t print (const char[])
 Print a null-terminated array of char variables (a c-string) to the stream or file.
 
size_t print (char)
 Print a single character to the stream or file.
 
size_t print (unsigned char value, int base=DEC)
 Print an unsigned char (byte value, 8 bits) in the specified base to the stream or file. More...
 
size_t print (int value, int base=DEC)
 Print an int (32 bit integer) the specified base to the stream or file. More...
 
size_t print (unsigned int value, int base=DEC)
 Print an unsigned int (32 bit unsigned integer) the specified base to the stream or file. More...
 
size_t print (long value, int base=DEC)
 Print a long (32 bit integer) the specified base to the stream or file. More...
 
size_t print (unsigned long value, int base=DEC)
 Print a unsigned long (32 bit unsigned integer) the specified base to the stream or file. More...
 
size_t print (double value, int dec=2)
 Print a double floating point value to the stream or file. More...
 
size_t print (const Printable &)
 Print an object derived from Printable to the stream or file.
 
size_t println (const char[])
 Print a null-terminated array of char variables (a c-string) plus a CRLF end-of-line terminator to the stream or file.
 
size_t println (char value)
 Print a single character plus a CRLF end-of-line terminator to the stream or file.
 
size_t println (unsigned char value, int base=DEC)
 Print an unsigned char (byte value. 8 bits) in the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (int value, int base=DEC)
 Print an int (32 bit integer) the specified base to plus a CRLF end-of-line terminator the stream or file. More...
 
size_t println (unsigned int value, int base=DEC)
 Print an unsigned int (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (long value, int base=DEC)
 Print a long (32 bit signed integer) the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (unsigned long value, int base=DEC)
 Print a unsigned long (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (double value, int dec=2)
 Print a double floating point value plus a CRLF end-of-line terminator to the stream or file. More...
 
size_t println (const Printable &)
 Print an object derived from Printable plus a CRLF end-of-line terminator to the stream or file.
 
size_t println (void)
 Print a CRLF end-of-line terminator to the stream or file.
 
template<typename... Args>
size_t printf (const char *format, Args... args)
 Print using printf-style formatting to the stream or file. More...
 
template<typename... Args>
size_t printlnf (const char *format, Args... args)
 Print using printf-style formatting plus a CRLF end-of-line terminator to the stream or file. More...
 

Detailed Description

Replacement for UDP class to use Ethernet.

Replace UDP with IsolatedEthernet::UDP to use Ethernet instead of the Particle device's native networking (cellular or Wi-Fi).

Member Function Documentation

◆ available()

virtual int IsolatedEthernet::UDP::available ( )
virtual

Get the number of bytes that can be read after parsePacket.

Returns
number of bytes left to read in the packet

The number of bytes will decrease for each read() call made.

Implements Stream.

◆ begin()

virtual uint8_t IsolatedEthernet::UDP::begin ( uint16_t  port,
network_interface_t  nif = 0 
)
virtual

Initializes a UDP socket.

Parameters
portThe local port to connect to.
nifThe network interface to connect to (not used, pass 0)
Returns
non-zero on success

◆ beginPacket() [1/2]

virtual int IsolatedEthernet::UDP::beginPacket ( const char *  host,
uint16_t  port 
)
virtual

Begin writing a packet to the given destination. It is often better to use sendPacket() instead.

Parameters
hostThe DNS hostname to send to.
portThe destination port of the peer
Returns
non-zero on success.

DNS will be done for every packet when using a hostname, the result is not cached. If you will be sending numerous packets you should resolve the hostname once and save the IPAddress instead.

The beginPacket() and parsePacket() functions share a buffer so you should never use both at the same time.

◆ beginPacket() [2/2]

virtual int IsolatedEthernet::UDP::beginPacket ( IPAddress  ip,
uint16_t  port 
)
virtual

Begin writing a packet to the given destination. It is often better to use sendPacket() instead.

Parameters
ipThe IP address of the destination peer.
portThe destination port of the peer
Returns
non-zero on success.

The beginPacket() and parsePacket() functions share a buffer so you should never use both at the same time.

◆ buffer()

const uint8_t * IsolatedEthernet::UDP::buffer ( ) const
inline

Returns the buffer used by parsePacket() and beginPacket()

Returns
const uint8_t* Pointer to the buffer

◆ endPacket()

virtual int IsolatedEthernet::UDP::endPacket ( )
virtual

Sends the current buffered packet over the network and clears the buffer.

Returns

◆ find() [1/2]

bool Stream::find ( char *  target)
inherited

Reads data from the stream until the target string is found.

Parameters
targetThe string to search for (null-terminated c-string)
Returns
true if target string is found, false if timed out (see setTimeout)

◆ find() [2/2]

bool Stream::find ( char *  target,
size_t  length 
)
inherited

Reads data from the stream until the target string is found.

Parameters
targetThe string to search for. The string is specified by length so it does not need to be null-terminated.
lengthThe number of bytes in target to search for.
Returns
true if target string is found, false if timed out (see setTimeout)

◆ findUntil() [1/2]

bool Stream::findUntil ( char *  target,
char *  terminator 
)
inherited

Reads data from the stream until the target string is found or the terminator string is found.

Parameters
targetThe string to search for (null-terminated c-string)
terminatorThe terminator string to search for (null-terminated c-string)
Returns
true if target string is found, false if timed out (see setTimeout)

◆ findUntil() [2/2]

bool Stream::findUntil ( char *  target,
size_t  targetLen,
char *  terminate,
size_t  termLen 
)
inherited

Reads data from the stream until the target string is found or the terminator string is found.

Parameters
targetThe string to search for. The string is specified by length so it does not need to be null-terminated.
targetLenThe number of bytes in target to search for.
terminateThe terminator string to search for. The string is specified by length so it does not need to be null-terminated.
termLenThe number of bytes in terminator to search for.
Returns
true if target string is found, false if timed out (see setTimeout)

◆ flush()

virtual void IsolatedEthernet::UDP::flush ( )
virtual

Blocks until all data has been sent out.

Implements Stream.

◆ isOpen()

bool IsolatedEthernet::UDP::isOpen ( sock_handle_t  sock)

Returns true if the socket is currently open. Used internally.

Parameters
sock
Returns
true
false

If you want to see if a connection is open, use connected() or status().

◆ joinMulticast()

int IsolatedEthernet::UDP::joinMulticast ( const IPAddress &  ip)

Join a multicast network.

Parameters
ipThe multicast IP address. This must be a multicast IP address, not a LAN address.
Returns
true if successful, false if not.

You must call begin() before joinMulticast() because the port is specified as a parameter to begin().

You can only bind to a single multicast address per UDP object.

◆ leaveMulticast()

int IsolatedEthernet::UDP::leaveMulticast ( const IPAddress &  ip)

Leave a multicast network.

Parameters
ipThe multicast IP address to leave. This parameter is not used
Returns
true if successful, false if not.

When you leave a multicast network it turns the socket back into a normal unicast socket, as when you call begin(). If you want to free all resources, you must also call stop().

◆ parseFloat()

float Stream::parseFloat ( )
inherited

returns the first valid float value from the current position

Initial characters that are not digits (or the minus sign or .) are skipped float is terminated by the first character that is not a float character. Decimal part is separate by '.'.

◆ parseInt()

long Stream::parseInt ( )
inherited

returns the first valid (long) integer value from the current position

Initial characters that are not digits (or the minus sign) are skipped integer is terminated by the first character that is not a digit.

◆ parsePacket()

virtual int IsolatedEthernet::UDP::parsePacket ( system_tick_t  timeout = 0)
virtual

Reads a UDP packet into the packet buffer. You should use receivePacket instead.

Parameters
timeoutTimeout in milliseconds, or 0 to not wait
Returns
int number of bytes in the packet or -1 for error or no packet available.

Aside from parsePacket() / read() being much less efficient, another problem is that parsePacket() does not differentiate between no data available and an error getting a packet. When listening for packets, if the underlying network goes away, all listeners are closed and must be reopened using begin(). The parsePacket() method does not differentiate between the case where no packet has arrived yet and packets will never arrive again (because you need to call begin() again). This is very annoying and does not occur with receivePacket() which returns all three states separately.

The beginPacket() and parsePacket() functions share a buffer so you should never use both at the same time.

◆ peek()

virtual int IsolatedEthernet::UDP::peek ( )
virtual

Returns the next character that read() will return without consuming it.

Returns
The byte (0-255) or -1 if there are no bytes available.

Implements Stream.

◆ print() [1/6]

size_t Print::print ( double  value,
int  dec = 2 
)
inherited

Print a double floating point value to the stream or file.

Parameters
valueThe value to print.
decThe number of decimal places to include for the fractional part. Default: 2

◆ print() [2/6]

size_t Print::print ( int  value,
int  base = DEC 
)
inherited

Print an int (32 bit integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [3/6]

size_t Print::print ( long  value,
int  base = DEC 
)
inherited

Print a long (32 bit integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [4/6]

size_t Print::print ( unsigned char  value,
int  base = DEC 
)
inherited

Print an unsigned char (byte value, 8 bits) in the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [5/6]

size_t Print::print ( unsigned int  value,
int  base = DEC 
)
inherited

Print an unsigned int (32 bit unsigned integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ print() [6/6]

size_t Print::print ( unsigned long  value,
int  base = DEC 
)
inherited

Print a unsigned long (32 bit unsigned integer) the specified base to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ printf()

template<typename... Args>
size_t Print::printf ( const char *  format,
Args...  args 
)
inlineinherited

Print using printf-style formatting to the stream or file.

Parameters
formatprintf-style formatting string
argsvariable arguments

◆ println() [1/6]

size_t Print::println ( double  value,
int  dec = 2 
)
inherited

Print a double floating point value plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print.
decThe number of decimal places to include for the fractional part. Default: 2

◆ println() [2/6]

size_t Print::println ( int  value,
int  base = DEC 
)
inherited

Print an int (32 bit integer) the specified base to plus a CRLF end-of-line terminator the stream or file.

Parameters
valueThe value to print
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [3/6]

size_t Print::println ( long  value,
int  base = DEC 
)
inherited

Print a long (32 bit signed integer) the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [4/6]

size_t Print::println ( unsigned char  value,
int  base = DEC 
)
inherited

Print an unsigned char (byte value. 8 bits) in the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [5/6]

size_t Print::println ( unsigned int  value,
int  base = DEC 
)
inherited

Print an unsigned int (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ println() [6/6]

size_t Print::println ( unsigned long  value,
int  base = DEC 
)
inherited

Print a unsigned long (32 bit unsigned integer) the specified base plus a CRLF end-of-line terminator to the stream or file.

Parameters
valueThe value to print.
baseThe base to print. Default is DEC (decimal). Other values are HEX (hexadecimal), OCT (octal), and BIN (binary).

◆ printlnf()

template<typename... Args>
size_t Print::printlnf ( const char *  format,
Args...  args 
)
inlineinherited

Print using printf-style formatting plus a CRLF end-of-line terminator to the stream or file.

Parameters
formatprintf-style formatting string
argsvariable arguments

◆ printTo()

virtual size_t IsolatedEthernet::UDP::printTo ( Print p) const
virtual

Prints the current read parsed packet to the given output.

Parameters
p
Returns

Implements Printable.

◆ read() [1/3]

virtual int IsolatedEthernet::UDP::read ( )
virtual

Read a single byte from the read buffer. Available after parsePacket().

Returns
The byte read (0-255) or -1 if there are no bytes available.

You should use receivePacket() instead of parsePacket() / read().

Implements Stream.

◆ read() [2/3]

virtual int IsolatedEthernet::UDP::read ( char *  buffer,
size_t  len 
)
inlinevirtual

Reads multiple bytes. Available after parsePacket().

Returns
The number of bytes read. Could be < len.

This is not the same as receivePacket() even though it has the same prototype. This method reads the bytes left in the packet buffer filled in by parsePacket(). The various read() methods consume the data in the buffer until empty.

Even though this method takes a char * buffer, it does not create a c-string. The data could be binary, may contain embedded nulls, and is not null-terminated.

You should use receivePacket() instead of parsePacket() / read().

◆ read() [3/3]

virtual int IsolatedEthernet::UDP::read ( unsigned char *  buffer,
size_t  len 
)
virtual

Reads multiple bytes. Available after parsePacket().

Returns
The number of bytes read. Could be < len.

This is not the same as receivePacket() even though it has the same prototype. This method reads the bytes left in the packet buffer filled in by parsePacket(). The various read() methods consume the data in the buffer until empty.

You should use receivePacket() instead of parsePacket() / read().

◆ readBytes()

size_t Stream::readBytes ( char *  buffer,
size_t  length 
)
inherited

Read chars from stream into buffer.

Parameters
bufferThe buffer to read into
lengthThe number of bytes to read
Returns
the number of characters placed in the buffer (0 means no valid data found)

◆ readBytesUntil()

size_t Stream::readBytesUntil ( char  terminator,
char *  buffer,
size_t  length 
)
inherited

Read chars from stream into buffer until the character terminator is found.

Parameters
terminatorThe character to stop reading
bufferThe buffer to read into
lengthThe number of bytes to read
Returns
the number of characters placed in the buffer (0 means no valid data found)

The terminator could be some thing like \n (newline), \t (tab), etc. depending on the data you are parsing.

◆ readStringUntil()

String Stream::readStringUntil ( char  terminator)
inherited

Reads the remainder of the file into a string or until terminator is found.

Parameters
terminatorThe character to stop reading at.

◆ receivePacket() [1/2]

virtual int IsolatedEthernet::UDP::receivePacket ( char *  buffer,
size_t  buf_size,
system_tick_t  timeout = 0 
)
inlinevirtual

Retrieves a packet directly. You should use this method instead of parsePacket().

Parameters
bufferThe buffer to read data to (char *). It may contain binary data.
buf_sizeThe buffer size
timeoutIn milliseconds to wait for a packet, or 0 = do not wait and return 0 if there is no packet available.
Returns
The number of bytes written to the buffer, a negative value on error, or 0 if no packet is available and timeout == 0.

Even though the buffer is a char *, there is no guarantee the packet will contain a c-string. It could contain embedded nulls, and may not be null-terminated.

This does not require the UDP instance to have an allocated buffer.

If the buffer is not large enough for the packet, the remainder that doesn't fit is discarded.

◆ receivePacket() [2/2]

virtual int IsolatedEthernet::UDP::receivePacket ( uint8_t *  buffer,
size_t  buf_size,
system_tick_t  timeout = 0 
)
virtual

Retrieves a packet directly. You should use this method instead of parsePacket().

Parameters
bufferThe buffer to read data to (uint8_t *). It may contain binary data.
buf_sizeThe buffer size
timeoutIn milliseconds to wait for a packet, or 0 = do not wait and return 0 if there is no packet available.
Returns
The number of bytes written to the buffer, a negative value on error, or 0 if no packet is available and timeout == 0.

This does not require the UDP instance to have an allocated buffer.

If the buffer is not large enough for the packet, the remainder that doesn't fit is discarded.

This method is preferable to parsePacket() for several reasons:

◆ releaseBuffer()

void IsolatedEthernet::UDP::releaseBuffer ( )

Releases the current buffer, discarding any previously allocated memory.

After this call only sendPacket() and receivePacket() may be used, until a new buffer is set via setBuffer().

◆ remoteIP()

virtual IPAddress IsolatedEthernet::UDP::remoteIP ( )
inlinevirtual

Return the IP address of the other side of the connection.

Returns
IPAddress IP address

◆ remotePort()

virtual uint16_t IsolatedEthernet::UDP::remotePort ( )
inlinevirtual

Return the port number of the other side of the connection.

Returns
uint16_t Port number

◆ sendPacket() [1/2]

virtual int IsolatedEthernet::UDP::sendPacket ( const char *  buffer,
size_t  buffer_size,
IPAddress  destination,
uint16_t  port 
)
inlinevirtual

Sends an packet directly. You should use this method instead of beginPacket(), write(), and endPacket().

Parameters
bufferPointer to a buffer to send (const char *), can be binary data.
buffer_sizeSize of buffer in bytes, must be > 0.
destinationThe IP address to send to.
portThe port to send to.
Returns
The number of bytes sent in the packet, or a negative error code.

Even though the parameter is a const char *, buffer is not treated as a c-string; pass stren(buffer) as the buffer_size if desired.

This does not require the UDP instance to have an allocated buffer.

◆ sendPacket() [2/2]

virtual int IsolatedEthernet::UDP::sendPacket ( const uint8_t *  buffer,
size_t  buffer_size,
IPAddress  destination,
uint16_t  port 
)
virtual

Sends an packet directly. You should use this method instead of beginPacket(), write(), and endPacket().

Parameters
bufferPointer to a buffer to send (const uint8_t *), can be binary data.
buffer_sizeSize of buffer in bytes, must be > 0.
destinationThe IP address to send to.
portThe port to send to.
Returns
The number of bytes sent in the packet, or a negative error code.

This does not require the UDP instance to have an allocated buffer.

◆ setBuffer()

bool IsolatedEthernet::UDP::setBuffer ( size_t  buffer_size,
uint8_t *  buffer = NULL 
)

Allocates a buffer for parsePacket(). Default is 512 if not specified.

Parameters
buffer_sizeThe size of the read/write buffer. Can be 0 if only readPacket() and sendPacket() are used, as these methods use client-provided buffers.
bufferA pre-allocated buffer. This is optional, and if not specified the UDP class will allocate the buffer on the heap.
Returns
true if successful or false if the memory allocation failed.

◆ setTimeout()

void Stream::setTimeout ( system_tick_t  timeout)
inherited

Sets the read timeout (default: 1000 milliseconds)

This makes more sense for network and serial streams.

◆ socket()

sock_handle_t IsolatedEthernet::UDP::socket ( )
inline

Returns the internal socket handle for this connection.

Returns
sock_handle_t

◆ write() [1/5]

size_t Print::write ( const char *  str)
inline

Write a null-terminated c-string the stream or file.

Parameters
strpoint to a null-terminated c-string.

◆ write() [2/5]

virtual size_t IsolatedEthernet::UDP::write ( const uint8_t *  buffer,
size_t  size 
)
virtual

Writes to the currently open packet after a call to beginPacket().

Returns
a positive number if the data was written, 0 otherwise. Note that the data is buffered and not sent over the network.

Reimplemented from Print.

◆ write() [3/5]

virtual size_t Print::write ( const uint8_t *  buffer,
size_t  size 
)
virtual

Write a bytes specified by a buffer and length to the stream or file.

Parameters
bufferpointer to the buffer. The data does not need to be null-terminated.
sizesize in bytes

Reimplemented from Print.

◆ write() [4/5]

virtual size_t Print::write ( uint8_t  c)
virtual

Write a single byte to the stream or file.

Parameters
cThe byte to write. All values 0 - 255 are allowed.

Implements Print.

◆ write() [5/5]

virtual size_t IsolatedEthernet::UDP::write ( uint8_t  )
virtual

Writes to the currently open packet after a call to beginPacket().

Returns
1 if the data was written, 0 otherwise. Note that the data is buffered and not sent over the network.

Implements Print.


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