Websocket Client stops receiving after a short period

Hello,

I have a problem with a websocket connection using a w5500. A stm32f (w55000 & mbed os) talking to a raspberry pi running node-red.
Sending data to node-red is working fine but after a few minutes the stm32f client do not receive any data (while still sending json packages of around 100 characters every 5 seconds).
I check with ws_isConnected() but it takes 10-30 seconds until it returns false. Reconnect work fine but soon it will start over again.
Node-red thinks to have a working connection and if the client reconnects and counts up one connection.
If I restart the server socket on node-red it again takes around 30 seconds until the stm32f recognizes that the connection was lost and then I can reconnect without a problem.
All is installed in a local LAN with fixed IPs the raspberry server and 5 clients (all connected to individual ws:// urls) on one switch.No router or internet involved.
My questions

  • How can I improve stability
  • How can I determine if the client is not receiving on the client (w5500) side?
  • Has somebody a reliable Mbed websocket library with example code for the w5500 (mine is from the mbed site)
  • Any idea how to check if the problem is on the client or server side? (I tested wireshark but not experienced enough to get results)

Thank you for your help.
Chris.

All are having same MAC address?

Nope … all different! Sorry, would be too easy.
But the idea was good. The Controller PCB have a dip switch to hardcode a device ID for MAC and IP Address and used to identify the messages by the server. All working fine

Hi,

Can you capture ethernet packets with wireshark.exe, which is free software, and share it with us?
It would be helpful for us to analyze the reason.

Thank you.

James.

Thank you for your help. I can do that, the server is running linux on a raspberry and I already installed wireshark.
Do you can give me a hint where to look for, any useful filter settings? Normally I am overwhelmed by the amount of information and have no experience in using wireshark.

What is configured as gateway for W5500?

The gateway of my network. I wanted to say during the communication ther is no traffic over routers or through the Internet involved. As far as I intentionally coded it there should be no traffic behind the switch and the devices.

There will be traffic to the gateway, at least ARP requests. Only network log will show. Not sure but these 30 seconds may be a timeout for something (e.g. ARP request). Just a guess.

The 30 seconds does suggest a timeout. See the following from the W5500 datasheet.

Try to read the registers RX Free Size Register.
At the time of “hang” of the socket. If they are much larger than a socket size> 30000, then perhaps you have not written the buffer pointer correctly (Sn_RX_RD).

Is there an example of w5500 websocket with stm32 ?