udpc_write()
#
udpc_write()
sends a log message over UDP, formatting it according to the specified output format.
Prototype
int udpc_write(
udpc_t udpc,
int priority,
const char *bf,
size_t len
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A handle to the UDP client instance. |
|
|
The priority level of the log message, ranging from |
|
|
The log message to be sent, which must be a null-terminated string. |
|
|
The length of the log message in bytes. |
Return Value
Returns 0
on success, or -1
if an error occurs.
Notes
If the message length exceeds the buffer size, the function returns an error.
The function ensures that the message is properly formatted based on the selected output_format_t
.
If the UDP socket is not open, udpc_write()
attempts to reopen it before sending the message.
Messages are sent in chunks of udp_frame_size
if they exceed the frame size.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples