I have recently purchased beaglebone (revision A6). My query is probably a naive one, but I will really appreciate a quick response.
I have a set up in which I keep updating my home web-server (http://localhost) with some data. Now this data needs to be accessed by the beaglebone which is connected through a USB cable to the PC which runs this web-server. on the web-server I need to access a particular file and a particular field in that file, as shown below:
- Accessing file on localhost, named ‘teraterm4’
- File named ‘teraterm4’ will contain information in the format: [Day Date Time] …string of data…
I want to access the second last set of 4 bits from the string of data as shown in the red boxes below.
The second bullet is not as much crucial as the first bullet, because my guess is if the beaglebone can access the file ‘teraterm4’ the rest of the job is pretty straight forward. We just need a code which stores the string of data into an array and move the pointer to the desired location.
Anyway, let me hear your views. And let me reiterate, that the first bullet is more crucial and I would like your help on that.
Thanks & Best Regards,
You can’t use localhost as that always refers to the host that is most local (hence the name).
On the PC that is the PC but on the bone it is the bone.
It sounds like you are already running a web server on the PC, thats good.
From the bone you will need to use the IP address of the PC as seen from the bone; the PC side IP address of the USB ethernet connection
If your running the latest SW I think that would be 192.168.7.1. It is for the BeagleBone Black.
Otherwise run ipconfig (windows) or ifconfig (Linux and mac?) to get the address.
Thanks for the reply wmills and apologies for the rather incomplete information.
- On the system at which I am hosting the webserver, I am using windows 7 OS. On the Beaglbone it is angstrom linux.
- The programming environment will be most probably C as I am most familiar with that. I do not have much idea about how easy would it be to program in other languages/scripts on the beaglebone for this purpose. That being said, right now the second point is not critical, rather it will not become critical unless we solve the first problem, that is accessing the localhost files (file named ‘teraterm4’). Below are some more screenshots:
So, I am able to ping the web-server PC. How should I proceed to access those files now?
Thanks & Best Regards,
Your now out of beaglebone specific territory.
Google is your friend both for how to configure your webserver and for how to process the data on the bone.
However I will help with one more step and point you for the next.
From the beaglebone command line just do:
If the above does not work try browsing to that URL from the PC and fix your webserver configuration until it works.
Make sure it is listening on all IP ports not just the loopback port.
When correctly configured you should be able to browse to any of the URLs below:
WRT Q2, you can do it in C. However, I would suggest you look into a script language.
It would be worth the effort to learn.
Thanks a lot wmills! It helped!
I am able to access the file contents on beaglebone now. Find the screenshots attached.
I am recapturing the whole thing again:
- teraterm4 file on webserver contains data of interest:
- this teraterm4 file contains data of the following type, and I need to access the data in red box.
- teraterm4 file was transferred from webserver to the beaglebone using
the data in red circles is the required data.
Thanks once again wmills for helping me out. Apologies for annoying you with naive questions.
Regarding Q2, I would get back to you.
To get file use the following. You could pass to a pipe and the use awk, mawk,sed,etc to parse for the specific section you are looking for. Look at standard shell programming.
here is an example http://tiny.cc/857iww