Server for arduino - java

I am trying to set up a server to receive data from arduinos and display the data on a website. I can handle the arduino client side but...
I purchased a website through hostgator and am completely lost on how to use a service such as that to get what I want. Using an arduino as a server, or using a private or lab server is not an option.
I could do it in java, but the service would won’t support java unless I spend more money for a dedicated server and I’m not willing to do that.
Any help would be greatly appreciated!

Are you set on using an Arduino?
If your aim is to stream data directly to a web server, there are plenty of better options out there with built in wifi and all the libraries you could dream of.
I suggest a nodeMCU, or if you are set on an arduino, you will need an ethernet shield.

Related

How to make a server to send arduino sensors data to use it in my java application

I have an arduino device and i want to send the arduino sensors data to a server so i can fetch the data and store it in sqlite database and use it in my java application.
I already bought a domain name from goDaddy but I don’t know to do next, can you please help me?
You need a server, and you may be able to get one for free, but if you can't than you would need to rent a server from one of the many companies offering such service. You can get one from Amazon AWS, Google GCP, or smaller but not less reliable companies like Digital Ocean.
You need the minimum and least expensive configuration of a virtual machine which you will connect to using SSH text terminal. For instance you can get a Linux server and have your code run behind Apache webserver.
You can send data from Arduino to your server using simple GET strings over HTTP/S or utilize MQTT if you need the server to also send commands to the board.

Arduino and a Web Server JAVA online, how makes a communication?

I was trying make the communication between a page hosted in Web Server JAVA and the arduino , but i don't got successes . I have a page JSP hosted in Web Server JAVA and i want use there to control the arduino , sending and getting data : temperatura , state of lamp , control of my gate and others .. But , how to do this ?
your question is too broad. There are many ways of doing this. Primarly, you should understand how will you connect the computer running the web server to the arduino. Is it physically connected to it via a serial port, ethernet or wirelessly? does the arduino have an ethernet or wifi shield? bluetooth? usb?
With that solved, it should be somewhat easy to make your JSP delegate on a Servlet which, in turn, would interact with the arduino depending on the form of connection mentioned before.
But, in general, this has little to do with web/JSP and a lot to do with arduino communication. Hope it helps. If you provide further details I can refine my answer.

Java Server for Android Application

I need to write a server in java that will store integers that are used as stats for my android app. My app has an SQLite database that is already setup that would be useful if I could just pass those contents to the server. I need to do this so that in my multiplayer feature, a player's app will contact the server to know what level their opponent is. (This is not real time). So far I only have a TCP server that opens a client and server socket. Other than that I am not positive what I need to do to make it possible for the server to do what I need. Anyone have suggestions or good tutorials to help me with my problem?
Thanks.
One thing you need to keep track of:
Your SQLite DB has to be used as a player session, until the player logs in as another user. To do this, you have to have one instance of the current logged in player. If you prefer other methods, here's a good list.
I don't think you would need a TCP connection to view the stats, instead implement a REST API in PHP or any other language for back-end that would save, update and look up for a particular player. This is a recommended method. If you are familiar with PHP, this tutorial will give you an idea and full details of what I mean.
Indeed, building a server has many methods. For example, You can use either socket programming or app-server. If you are familiar with web programming, jsp/php/asp.net, you can communicate between your app and server with HTTP requset, which is easy to do.
To be more specific, someone (neme:abc,password:pwd) logging in with your mutiplayer app, when he or she leaves, send the data to server with HTTP request. Then when he or she logging in with other device, you can get the data from status and continues to play. Of course, you can save the data in local with SharedPrefence in Android, too.
By the way, the apache HTTPClient is recommend when using http connection with server.

Uniquely connect an android application to a java applet on pc

I want to connect my android application to an applet which is running on my pc on Google chrome on Wi-fi.. where my phone works as a wi-fi hotspot and pc as the connected device. I want the connection to work uniquely as I want commands to be passed from my application to the specific applet, on the execution of which my applet does specific tasks. Please tell me the APIs which I can look in both Java and Android or the technology I have to use to make it work..
You need to use any program, such as wamp server, to make your computer to be a localserver. It will install PHP 5, MySQL and Apache. In other hand, you will also need a little bit of knowledge in Php language to create you own web services.
Another thing you need to be aware is that to handle you connection between server and device (and by this I mean which IP you are going to use) you will have a little headache; but first things first..break your problem in little parts thus will be easier to solve them.
I recommend this tutorial.
I think the simple way to connect these two softwares is using UDP.
It is fast, it is easy to program but it is generally unreliable according to TCP. But it is already local network. I dont think that is a case you need to take care in your local wifi network.
So take a look at this tutorial http://tutorials.jenkov.com/java-networking/udp-datagram-sockets.html
There are other ways like https://www.alljoyn.org/. It has more functinality but more complicated.
You must install Server on your PC(Apache httpd or apache tomcat or other based on your interest). A server listens to request from clients. When your mobile is connected to your pc(doesn't matter wire or wireless), you can make a request to an url(say, localhost:8080/welcome) from your app.
Create an applet and connect it with your web application(in the server) using java.net.URL and java.net.URLConnection.
On performing some operation on the client, call the url of the server application and forward the response to the applet.

Making a client-server chat - running into issues with connecting client to client

I am trying to learn how to make a multiple-client chatting program. Im following the Oracle tutorial on Custom Networking, but its not really what I am looking for. So far, I have no code of my own to share, all of it is copied from the Oracle tutorial and I think pasting it here would be a copyright infringement(??).
link at: http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html+
client code link: http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/networking/sockets/examples/KnockKnockClient.java
anyway, I have the server-client working where the server tells knock knock jokes, the client reads and prints, then the user replies and so on. how would i start to edit it to have the client talk to the other clients directly?
im sorry, i have no background with networking at all. if anyone can direct me to a informative source better suited to my goals i would appreciate it.
as in the Knock-Knock example, each client connects to the server, but they not mutually directly connected.
There is a solution to make a forwarding sever :Arrange each client an id, and clients use id to identify their talking partners.
To do this, you have to modify the client to server data format from a plain string to a tuple like (String,Id). And, when the server receive the data, it parses out the id, get the corresponding client socket and then write the data.
The required level of complexity just went up a notch as your going to need some sort of "interprocess communications" infrastructure to allow client to client communication (possibly via sockets marshalled by the server?)

Categories

Resources