I’m broadly new to vuejs and socket.io and nodejs.
I wrote an single page application to communicate between a nodejs server (running on an Raspberry pi) and a Siemens S7-1500 PLC. Those ones are connected over ethernet and the raspi is getting me an wifi access point for control the PLC with a smartphone, tablet or Desktop.
I’m almost done, but I struggled at that point. I am using socket.io to send events to the client an back. For that i need to know the ip address of my sever inside my vuejs application with is bundled with webpack.
As I get to the point as I was trying to deploy my App onto the Rapberry Pi I didn't found a way to set the IP address dynamically inside my application.
Perhaps some of you guys could open my eyes and give me a Tipp for the solution.
How it's possible to send the IP Address to the client? My Application is running locally and there is no need to do not so.
In my mind it should be possible to send the server ip to the client.
Thank you for your Answers :)
Greetings Denis
You can use linux ifconfig command in order to get your IP from command line of the host application is hosted on. IP is not sth that you set on application level, but ussually is automatically asigned for the given host. So it depends on how your network is set up.
Look for sth like "How to give your Raspberry Pi a Static IP Address".
Related
Idea
I am tring to make two applications one on PC and one on android phones(maybe IOS). My desktop app is build on python and the phone app with .dart on flutter emul.
Basically the only thing I want is to pass a variable from my phone to a desktop and do something with it. Of course the 2 devices will be on the same home network.
Question
I have already tested HTTP requests and TCP connection and I got both of them to work. My problem is that I want this app to go online eventually and as things are the connection is made on my IPv4, that is different in every device.
How can I make the desktop server side to wait for a phone to connect on it and the phone to search and find the open IP and port and the name of the device?
Will I be able to use the raspberry pi with node.js to control something connected to the pi with a website with wifi. And also will it be the same as php or will it have limitations
Yes, definitely !
Without knowing anything specific about what you are trying to achieve, I would say yes, no problem. I do it all the time. For example a simple NodeJs WebServer that serves a webpage, including a WebSocket Server to receive real-time commands or via REST API. Almost anything is possible.
I have successfully ported Linux kernel to Raspberry Pi board.
But now i need to have Internet connection into it.
And my internet connection is like, it needs a user name and password to login then only we can access Internet(wired internet through LAN or RJ 45 connector). And this interface for entering username and password comes in a browser.
But now in case of Raspberry pi , its just a kernel so , i do not have a browser in it.
So how to connect this internet connection in Board.
Thanks
The hardware solution is to use a home router that does the logging-in for you, and then acts as a gateway between your local LAN and the Internet. You would connect the Raspberry Pi to one of the router's LAN ports, and use either DHCP or static IPs on that local net.
A software solution might be using e.g. curl to implement some kind of login-script that fakes the accesses to the web page.
If you could connect it (temporarily) to an Internet connection that doesn't require a login/password, you could install a command line based browser. I would suggest looking into Lynx, if you choose to do it this way. http://en.wikipedia.org/wiki/Lynx_%28web_browser%29
I'm trying to build a simple web app that reads the clients' serial port that is connected to a barcode scanner. I have done this using ActiveX but it only works on IE browsers, i have heard that I can now do this using node.js and serial-node. Can someone tell me if this is even possible using these two technologies? Also if anyone can direct me to a working tutorial on how to do this. Thanks!
You can't read the serial port of the web app's client's computer using serial-node, no. Node.js and serial-node run server side, they do not have direct access to the web clients' hardware.
I am trying to access files on a network computer via a J2ME MIDlet. This MIDlet runs on a device that is connected to the network via a WI-FI router. The MIDlet can see the other devices (that is, it has visibility to the other devices's IP on the network).
Has anyone done this successfully? If yes, what connection API have you used and if you could share some code?
I have tried using the FileConnection API, but passing the following results in connection error:
conn = (FileConnection)Connector.open("file://IP_OF_COMPUTER_ON_SAME_NETWORK/");
As per the FileConnection API, you should be able to connect to devices on the network as it allows hostname access.
I am unable to run a web server on the designated computer otherwise I would just write a simple web script (and run a web server).
Thanks in advance,
Vikram
AFAIK, you can not access File from remote Computer directly. And if you still want to do it , your mobile must be connected with the remote computer by WiFi or GPRS.
Install apache on the remote computer and set it up as a server (localhost). You can then view the file folders via the phone browser.