Showing results for 
Search instead for 
Did you mean: 

Where to find LwIP incoming payload data for webserver?

Raymond Buck

STM32CubeIDE Version: 1.12.0
Build: 14980_20230301_1550 (UTC)

I have a STM32F407 Discovery board running a web server.  I have a simple webpage with a single button that when clicked, displays a text message below the button. I had issues with the server at first due to the const keywords that were in the fsdata.c file, but it is working fine now.

Where is the buffer for the incoming button click and the text message located? Is there a weak callback function somewhere that handles incoming data? I want to intercept the message and take action based on the incoming data.

I used STM32CubeIDE to create the server and accepted all of the default settings.



Pavel A.
Evangelist III

 some extra pbuf ACK handling in the TCP files

Could you tell more about this please?


@Pavel A. 

For a ~50 Mbit/s audio over TCP application which needs 100% reliability, no dropouts allowed,
I made the following changes :

- added a pointer pA2IpCtl (to my "audio to IP control struct" in DTCM) to the pbuf struct, which holds the control data (pointer to next control, pointer to audio buffer, buffer state, errors) for the actual audio data buffer (incl. own header)

- I copied and edited tcp_write() to a  tcp_write_a2ip() version which adds the pointer pA2IpCtl to the TCP pbuf

- in pbuf.c / pbuf_free() that pointer pA2IpCtl is checked if != NULL the audio buffer state is changed to free


I had no other idea how to accomplish that.

But at least it's working...

I am not sending another page request in my application. I had set that up just to confirm the website was working. All I will be sending to the server are button press notifications. I do have to figure how how to send an ACK back from the server. I currently get the message "Server request failed with status: 0" back when I click a button. This is the error message I put in a textbox if I don't get an OK message back from the server.

I also will probably have to check the board to confirm that the I/O that I toggled on or off actually worked and send that information back to the web page.

When you mention the server/client examples, are you referring to the echo examples of some other example?

@Raymond Buck Yes I refer to the HTTP server and client examples in Cube lib. package (by the way Cube packages for more recent MCU families can have more interesting examples).

As I tried to say earlier the web server/client stuff is complex - more complex than one wishes to know. These complications are crucial for efficient, reliable and secure communication. The ST examples are just as simple as possible to demonstrate the hardware operation. People are lured to use ST boards because of low price and seemingly "easy" tools - but then intimidated by need to implement a lot of software, from the app layer down to network drivers below L2. Of course, efficient solutions do exist, but people do not like them.


If you need ACK from any side, keep using TCP.

I have the STM as the webserver with 3 html pages, including some buttons, text fields and drop down menus.

All this is handled with SSI / CGI stuff, there are "tags" in html, these are checked in httpd.c, then a user SSI / CGI handler must be implemented.

I think there is an ST example, incl. a html page with buttons - without OS.