Is it possible to ESP32 read a file from a computer over the lan ?

llange
Posts: 2
Joined: Mon Oct 12, 2020 5:46 pm

Is it possible to ESP32 read a file from a computer over the lan ?

Postby llange » Mon Oct 12, 2020 6:03 pm

Hello everyone!

Sorry if the question is trivial, but I cannot figure out how and even if it is possible.

Problem is: I have a computer connected on a network with a fixed IP and I want to read a specific file on a specific folder on C: drive (like C:\test\file.txt). It is a plain text file, no special characters inside.
I should use an Ethernet adapter as the computer doesn't have Wi-Fi.
ESP32 must read it automatically and independently, no additional programs are allowed to run on this computer, so a webserver or similar is not an option.
I don't need to transfer or read all file content, just last 5 lines are important for the application. But I can transfer entire file and store if in SPIFFS and read it later if this is easier.

Today I have an RPi Zero doing this job, but the idea is to replace it by an ESP32.

Should I consider run it in MicroPtyhton?

Thank you in advance!
Luis

ESP_Sprite
Posts: 4034
Joined: Thu Nov 26, 2015 4:08 am

Re: Is it possible to ESP32 read a file from a computer over the lan ?

Postby ESP_Sprite » Tue Oct 13, 2020 3:11 am

It gets a bit tricky if you can't run anything on the computer, as you need a way to access files over the network. You could use the built-in Windows filesharing and a Samba implementation that can run on the ESP32 (e.g. https://github.com/sahlberg/libsmb2 , but look at the license to see if it's usable for your purpose) to get the file, but that's about all your options.

alanesq
Posts: 20
Joined: Thu Dec 14, 2017 8:38 pm

Re: Is it possible to ESP32 read a file from a computer over the lan ?

Postby alanesq » Tue Oct 13, 2020 6:56 am

If all else fails you could set up an FTP server on the computer and have the ESP32 access the file via FTP

PeterR
Posts: 544
Joined: Mon Jun 04, 2018 2:47 pm

Re: Is it possible to ESP32 read a file from a computer over the lan ?

Postby PeterR » Tue Oct 13, 2020 10:07 am

Today I have an RPi Zero doing this job, but the idea is to replace it by an ESP32.
How does the RPi Zero read the file ATM?
If all else fails you could set up an FTP server on the computer
That would have been my first choice but you say that additional programs are not allowed.

Shame you cannot add a program to the PC. A few lines of Javascript & you could perdiodically multicast the last few lines...
& I also believe that IDF CAN should be fixed.

llange
Posts: 2
Joined: Mon Oct 12, 2020 5:46 pm

Re: Is it possible to ESP32 read a file from a computer over the lan ?

Postby llange » Tue Oct 13, 2020 12:53 pm

Thank you all for your replies.

The target computer is part of a MRI equipment, that's the reason I cannot run additional softwares, supplier doesn't allow.
That file has some information about HW and sensors that should be monitored. Initial idea was to capture ethernet communication between MRI and computer, but it is forbidden by supplier. And as it is a very sensible equipment this would not be a good idea to insert a possible interference in communication.
PeterR wrote:
Tue Oct 13, 2020 10:07 am
Today I have an RPi Zero doing this job, but the idea is to replace it by an ESP32.
How does the RPi Zero read the file ATM?
Actualy there is an equipment that do this job, but running a RPi, and I don't know how it is doing this job as I cannot login it.

ESP_Sprite wrote:
Tue Oct 13, 2020 3:11 am
It gets a bit tricky if you can't run anything on the computer, as you need a way to access files over the network. You could use the built-in Windows filesharing and a Samba implementation that can run on the ESP32 (e.g. https://github.com/sahlberg/libsmb2 , but look at the license to see if it's usable for your purpose) to get the file, but that's about all your options.
I will check that Samba implementation, and also check if WinXP has a compatible file sharing with it.

Any other valuable ideas?

Thank you !
Luis

PeterR
Posts: 544
Joined: Mon Jun 04, 2018 2:47 pm

Re: Is it possible to ESP32 read a file from a computer over the lan ?

Postby PeterR » Tue Oct 13, 2020 8:50 pm

Hi,
That file has some information about HW and sensors that should be monitored. Initial idea was to capture ethernet communication between MRI and computer, but it is forbidden by supplier
I'd check that contract! Perhaps you would just like to monitor your network for viruses (etc) & post a Wireshark trace along with the IP of the target system so we can find any virus activity. I am sure that all reputable suppliers would wish that their client's were virus safe ;)
And as it is a very sensible equipment this would not be a good idea to insert a possible interference in communication.
Well this seems to be the same point as above; perhap commerical protection? You're supplier seems to be telling you that 'here be dragons'. Often this is just smoke & mirrors but there may be an effect. If you enable Window shares etc will that slow the computer, open the computer to virus etc?
PS a smart switch with a mirror port should keep you safe in court.

This does all seems part of your supplier 'smoke n mirrors' proposition. The supplier may very well carry some responsibility for the equipment however- if you reconfigure the equipment in any way you may invalidate that guarantee.

<rant>Don't get me wrong; most safety cultures I have worked in have been 'barking mad' but have the certificates & that keeps your insurance people happy. Certification is often more tick box than accomplished process or even rational.</rant>

It is an imperfect world but IMHO safety cultures often become enclosed cliques. Citations: (1) Had occasion to work in a team with 5 engineers who's full time job was to edit the same MS-Word test procedure. Was let go after suggesting splitting the document into file sections or god forbid a Wiki or automating testing. (2) On another occasion I was invited to save a project where the lead would enter the team's design into UML because 'the team did not understand UML' (guess there was a local procedure to use UML), (3) etc, etc. Oops, rant was supposed to be over ;)
You might say that the very nature of the safety 'guarantee' is something that inhibits competition and ultimately safety. I would not dare!
But if you break rank you no one will tell you if you're insured so you have to suck it in & live in the 50's :(

PS The fact that you cannot even read some standards without $$ would seem to me to run counter to engineering/scientific method. Oops, still ranting.
Nurse!
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Bing [Bot] and 48 guests