Force a http[FIN] command

Im trying to get an existing WebServer running via an WizFi250 module.
The module runs as an AP in TCP Server mode. It is connected via UART to a microcontroller.
The WebServer has some dynamic pages, where there is no HTTP content-length available.
Is there a way, how I can initiate an http[FIN] sequenze to signal the browser, that all data is transmitted.

If I use an “AT+SMGMT=0\r”, “AT+SCON=O,TSN,80,0\r” sequenze, then the connection will be terminated with a http[RST] and the communication will stop.

Best regards

Hello Kurt

—(UART)——(WiFi)—<Web Browser in PC/Smartphone>
And you want to operate WizFi250 as HTTP Server. Right?

But, how doesn’t MCU know the ?

In my guess, MCU would send the all HTTP data to using WizFi250?

If MCU use some buffer before sending HTTP data to , MCU can know the exact size of HTTP data.
(even though it is dynamic pages)

Did i misunderstand something?

Hallo ssekim
Thanks for your replay.
You are right - the MCU composes the HTTP data and could know the centent length.
However until now, the webserver was connected via an lwip-stack to the LAN. With lwip I could close a connection without reseting it. That’s the reason, the webserver simply closes the connetion when dynamic pages are used instead of writing the header, writing the data and then filling the content length of the data into the header.
If there is no way with WizFi250 to close a connection without reseting it, I have to adjust the webserver.

Best regards

Hallo ssekim
In the mean time I was looking into the webserver. On short replays the content length can be easily included. But on long replays with multiple frames (replay > then buffer size) this gets realy difficult. You would have to generate twice the replay. The first time just to calculate the length and the seconde time for the real transmitting with the content length.
The possibility of closing the connection without a restart would be extremely helpful.

Best regards

Hello kgw6373

I think that you had better use an “AT+SMGMT=0\r”, “AT+SCON=O,TSN,80,0\r” sequence.

For every TCP-connection, you should apply the timeout(3~5 seconds) in case of TCP-Client(HTTP)-not-disconnection and restart TCP Server for stable and continuous web server service.