-
Notifications
You must be signed in to change notification settings - Fork 13.3k
udp recived packets number #2928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
did you mean this: int packetSize = Udp.parsePacket(); |
nope, according to the header file WiFiUdp.h this wuold return the size of the packet in bytes. I think it's refearing to the first packet. So my question is how can i get the total number (and not size) of packets recived in the Udp buffer ? |
@igrr if it's not implemented i can try to do if you can kindly guide me from where should i start ? |
Take a look at UdpContext.h. There is a pbuf chain there, you can add a method to count the number of pbufs in the chain. |
@el3ctrician did you get around to implementing this? do you want to make a PR? |
@devyte i didn't have enough time to do it since the project that i was working on got cancelled, but i would like to try to implement it so maby i'll fork the code for a try this weekend ... |
Ok, post results or ask questions here. |
well actually i just saw that the pbuf in the udpContext, it is a linked list right ? i need to count by checking the pbuf.next right? or even here https://github.com/esp8266/Arduino/blob/4897e0006b5b0123a2fa31f67b14a3fff65ce561/tools/sdk/lwip/include/lwip/pbuf.h |
The pbuf api is lwip's. WiFiUdp through UdpContext makes use of it: The notion of packet is then wiped out showing udp's incoming data to the user as a stream, which is what it really is ( If this had to be changed, edit: the notion of packet bounds with the linked list would be trivial, albeit still doable in the current implementation with some way to remember these bounds. edit2: you may check @me-no-dev's AsyncUDP implementation which keeps the notion of packet. |
I am closing this due to age and lack of feedback. |
hello,
i would like to know if there is a way to get the number of packets in udp buffer and also to set the packet len according to the payload ?
thanks in advance
The text was updated successfully, but these errors were encountered: