I wrote the code for the web server. I try to implement an IOCP server. I wrote it in Visual C++ 2019, using the standard settings (ISO C++ 14).
The server is listening. When it receives a request from a web client, builds a package based on that request and sends it to the client. e.g. the client sends the request 'GET /index.htm bla, bla, ...', the server identifies the received command, searches for file 'index.htm', adds the necessary headers like (HTTP/1.1 200 OK, Server Name, bla, bla, ... ) and sends it back to the client. and so on... (something like CGI). everything works fine (as I want it to work) on a wi-fi/local network (intranet network). I open safari on my iPhone 13, type in a local address and enter. the server receives multiple connections, one for get index.htm, another for I don't know what picture, another for I don't know what css, etc, etc. For each request, the server looks for the respective file, puts its headers and sends the answer to the client. In this case the iPhone don't send null buffers and I keep the connection until idle or close the browser. It is ok.
But when I'm on 4G for example, I type the address. In the same way several connections are created, each one asks for something and receives ok. At the end of the reception (all things received, index.htm, img, css, etc, etc), iPhone sends to the server a lot of null buffers and load the socket with null packets. In this case I have to disconnect those sockets. In which case I lose IDs and other credentials
In conclusion, the same iPhone and Safari, when communicating with my server over the local network (same class of IPs), send only the requests found in the html files, without null buffers (it is ok), but when I'm connected to the internet (different IP classes), it sends requests from html files, but in the end it doesn't stop sending null buffers (I print each packet received by the server. the same is seen in WireShark). (it is not ok because I have to disconnect it).
When I use other devices other than Apple (like Android, Windows), everything goes very well, both on the intranet and on the internet.
I tried to take into account the requirements of the RFC, as much as I could and as much as I understood.
I will find a compromise solution in the end, but I do not understand why this happens.
Best Regards,
Catalin
Topic:
App & System Services
SubTopic:
General
Tags: