Webread does not work anymore, but urlread still does.

I have a small LAN setup, where my computer and the device I want to control is connected to an unmanaged switch and I use static IP addresses. I want to control the device via API and it already worked with a slightly different setup. There I had a router connected to the Internet and to my device and my Laptop was controlling the device over a WLAN connection. Here I also used DHCP.
Now I have established a connection with my device and I can read the data from the API with my browser and with urlread(), but the same url does not work with webread(). There always comes "Error using webread (line 122) Could not access server. URL".
My code:
webread(url)
After that did not work I thought it could be a problem with the certificate, because I have none. So I tried:
options = weboptions('CertificateFilename','');
webread(url, options)
However, this didn't do the trick either, so now I have no idea what to do next.
If someone could help me please it would be greatly appreciated!

 Réponse acceptée

Victoria Fill
Victoria Fill le 15 Oct 2021

0 votes

I have found my problem. Apparently webread/-write cannot deal with IP addresses where a 0 is the first digit such as: 192.168.01.xxx
I changed it to 192.168.1.xxx and it worked like a charm.
Does anyone know why this is only the case with webread and not with urlread?

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by