W5500 for Espruino JavaScript

Hi. I’ve been working on trying to get both HTTP Server and Client support for the W5500 built into the Espruino JavaScript interpreter, but I’m hitting some issues.

I’m pretty sure HTTP client and server work fine - they’re running on Linux via BSD sockets and also on TI CC3000. On the W5500 both are working, but intermittently.

HTTP GET is very intermittent when using DNS. It always gets the correct IP, but the ‘connect’ function will then sit there trying to connect without success.

HTTP GET only works when ~30 seconds are left between calls to HTTP get. Otherwise every other call fails with Socket error -7 (SOCKERR_SOCKSTATUS) from the send function.

HTTP Server works, but when accessing very often (for example holding down the refresh button) it can fail. Again, Espruino has -7 (SOCKERR_SOCKSTATUS) from send. If you keep this up, it is possible to cause the HTTP socket to stop receiving connections.

Some of this could be related to re-using sockets. I currently use this code to find a free socket - is there a better way? github.com/espruino/Espruino/bl … znet.c#L37

Maybe DNS sets up the socket mode somehow, and then the socket gets re-used for the HTTP GET and it is configured badly.

Info:

First off, interface for the W5500 is here: github.com/espruino/Espruino/bl … k_wiznet.c

HTTP Client/Server implementation here: github.com/espruino/Espruino/bl … tpserver.c

Information on using W5500 with Espruino: espruino.com/WIZnet

Hi Goden,

I’ll reproduce the problem and get back to you soon.

Thanks,
JB

Thanks! If you don’t need debug info, you can use this build (which matches what’s in GitHub):

espruino.com/binaries/git/co … wiznet.bin

Hi. Have you had any luck with this?

Is there any reason why getSn_SR wouldn’t report SOCK_CLOSED after disconnect + closesocket on a client socket? That might explain the issues with running out of sockets…