I understand that the [RST, SYN] packet is sent when no more sockets are available and, indeed, this happens when all sockets are busy.
Let me explain better the problem.
The sockets are initialized and they go to SOCK_LISTEN state. I can monitor the Sn_SRs of the various sockets and I see that they all assume the value = 0x14
When clients start the requests the states of the sockets move to SOCK_ESTABILISHED (Sn_SR = 0x17). This happens for all the sockets that receive a requests. In case of multiple simultaneous requests, more sockets go into state 0x17.
If one more request arrives when all sockets are in SOCK_ESTABILISHED state, W5500 answers back to the [SYN] packet with the [RST, ACK] packet, instead of the [SYN, ACK] as it does normally when a socket is available. As you wrote, the reason is the lack of an available socket. This is clear.
What happens is that, while on Windows based system the process continues and the browser at the end gets all files, on OSX / iOS systems the browser stops and does not get all files. Those requests that received [RST, ACK] answer are dropped and browser does not ask anymore or keep waiting.
I’m not telling that this could be a Wiznet problem, I’m only describing what happens with different browsers and on different OSs.
I attach two Wireshark capture files (see zip file):
- Wiznet-Firefox-Win7.pcapng: capture made on Windows7 system while getting the htm page using Firefox
- Wiznet-Safari-OSX.pcapng: capture made on MAC OSX system while getting the htm page using Safari.
Of course, the requested page is the same and the Wiznet is operating in the same condition and with the same configuration in both cases.
Following your suggestions, I tried to replace the DISCON command with the CLOSE command but what happens is that the browsers hang on and keep waiting the answer of the server, both on Windows and on OSX.
I cannot simplify the page and I also if I increase the web socket count (even up to 8), the problem is still present when all the available sockets are in the SOCK_ESTABILISHED state and more requests arrive.
As I told, I undestand that Wiznet has no more sockets available and it can not receive another request, but I do not understand the different behaviour in the two cases (PC and MAC or iPad).
The application we are developing with W5500 is a control unit for building automation and domotic systems with an integrated web server (you canhave a look to duemmegi.it/?idl=GB if you want to know about our systems) and we need to be compatible with all OSs and browsers. Up to now, everything works fine on Windows based systems but not on OSX and iOS.
Please let me know if you need some more details or if you have some suggestions or test that I can do.
Thank you very much
WiresharkCapture.zip (531 KB)