Custom web server

I want to make my own web server in AP mode.
I start AP mode, ant open TCP server connection with 80 port. Default web server is turned of (AT+FWEBS=0,M). So my code:

AT+FWEBS=0,M

AT+WSET=1,WizFiAP

AT+WSEC=1,WPA2,12345679

AT+SCON=O,TSN,80,0

Then I can connect to WizFiAP AP. If I put internal IP address of my wifi module in web browser, I get response from it into uart:
{0,192.168.12.102,35519,492}GET /demo_form.asp?fname=&lname= HTTP/1.1
Host: 192.168.12.101
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Linux; Android 6.0.1; SM-A310F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: lt-LT,lt;q=0.8,en-US;q=0.6,en;q=0.4,ru;q=0.2,pl;q=0.2

Then I send some html code, to see web page in phone:
AT+SSEND=0,353
[0,353]

HTTP/1.1 200 OK
Content-Type: text/html

Wellcome

You shall not pass

User name:
Password:

[OK]

So until this is all OK, I can see my simple web page in phone web browser. But Then I cannot receive any response from my web page to my wifi module in uart. I press button on my web page or I refresh page, I should get the same response from web page like first, but I get nothink. And just after some time (maybe 1minute) I can rehresh page and get that response again, but not with button.

What I make wrong, or wizfi250 cannot work like this? Thank you.

so I made some testing, I notice if I close tcp server connection after sending page, then my web browser end loading page, and if I imidiately open tcp server connection again, then I can receive next response from my web page, for example button click. Is there a way to make this socket reconnection automatically after web page sent?

simply not close the TCP server !

and do a test to verify that the socket is right open before start to send something
because the socket can be closed for several reasons.

regards

no, with send function is`t all ok. I can send. But If I send web page information (html code) in my phone browser, then I cannot receive any reply from phone web browser. I should get information about button click, or if I do page rehresh, but I get nothing. Just after I reopen the same port80 socket, then I can receive response from phone.

DO NOT CLOSE THE TCP SERVER after html data are send !

but as you reply “NO” to our recommendations, then you need to know it better than us !

regards