UDP_TX_PACKET_MAX_SIZE

Post here all questions related to STM32 core if you can't find a relevant section!
Post Reply
Step73
Posts: 27
Joined: Tue Jan 14, 2020 2:55 pm

UDP_TX_PACKET_MAX_SIZE

Post by Step73 »

In `EthernetUdp.h` I see the following `#define`:

Code: Select all

#define UDP_TX_PACKET_MAX_SIZE 24
1. Doing a search inside the arduino directories I cannot find any use of it but in the examples (at application level):

Code: Select all

step73@lap:~/Arduino/libraries$ grep -nrw . -e UDP_TX_PACKET_MAX_SIZE
./STM32duino_STM32Ethernet/src/EthernetUdp.h:45:#define UDP_TX_PACKET_MAX_SIZE 24
./STM32duino_STM32Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino:30:char packetBuffer[UDP_TX_PACKET_MAX_SIZE];  //buffer to hold incoming packet,
./STM32duino_STM32Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino:62:    Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
and

Code: Select all

step73@lap:~/.arduino15$ grep -nrw . -e UDP_TX_PACKET_MAX_SIZE
How and where this `#define` is used in the internal libraries?


2. Where is defined the size of the receive buffer?
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: UDP_TX_PACKET_MAX_SIZE

Post by mrburnette »

As you did not specify the exact library source, I assume this Ethernet library: https://github.com/arduino-libraries/Ethernet
With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet.

For more information about this library please visit us at https://www.arduino.cc/en/Reference/Ethernet
It would be preferable to ask your question on the Arduino Forum:
https://forum.arduino.cc/c/using-arduin ... devices/27

I have done my share of UDP on the ESP32/8266 and things can become complex.
* Udp.cpp: Library to send/receive UDP packets with the Arduino Ethernet Shield.
* This version only offers minimal wrapping of socket.cpp
* Drop Udp.h/.cpp into the Ethernet library directory at hardware/libraries/Ethernet/
*
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
* might not happen often in practice, but in larger network topologies, a UDP
* packet can be received out of sequence.
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
* aware of it. Again, this may not be a concern in practice on small local networks.
* For more information, see http://www.cafeaulait.org/course/week12/35.html
*
* MIT License:
* Copyright (c) 2008 Bjoern Hartmann
Step73
Posts: 27
Joined: Tue Jan 14, 2020 2:55 pm

Re: UDP_TX_PACKET_MAX_SIZE

Post by Step73 »

mrburnette wrote: Wed Sep 22, 2021 11:03 pm As you did not specify the exact library source, I assume this Ethernet library: https://github.com/arduino-libraries/Ethernet
Actually I did:

> STM32duino_STM32Ethernet/src/EthernetUdp.h
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: UDP_TX_PACKET_MAX_SIZE

Post by fpiSTM »

You have found all the occurrences. It is used at sketch level that's all.
It seems it is a default value, that's all. So you should be able to use an other value in the example.

The STM32Ethernet is based on the official Ethernet library from Arduino.
Looking at the official library, this issue has been raised:
https://github.com/arduino-libraries/Et ... issues/109
Post Reply

Return to “General discussion”