I need a remote computer to communicate with my android/iPhone apps to do things like promote, get stats... What's the fastest way to achieve this? No html needed, it's just for short (most likely JSON) messages between me and myself.
I have an account on my university's CS unix-based server on which I can host content. Tutorials greatly appreciated, thank you.
Now sure why you want to reinvent the wheel. Writing a web server would involve low level socket communication, putting up a protocol and bunch of code to handle these things. Please check Tiny Java web server, or Jetty .
You'll have to make a Web Application (maybe in PHP or Java), and then you'll have to host this application on a web server.
Related
I just mad a web service(REST api) in java that works locally but I don't have any idea how I upload it to a host server. I found some free host servers and got my server but I don't know how to upload my web service. can someone can give my some tips how to do it? thanks :]
Seems not to be an Android question... but anyways :)
You may need to dig a bit more on how to host applications in general. For people with not much knowledge on infrastructure or not willing to learn how to manage everything by themselves I suggest using services like Heroku.
For deploying your web service to heroku, you simply push the same way you push to a git server. If you no nothing about git, it is time to drop everything and go learn the basics.
It has a free tier and start charging you once your needs grow over that tier: https://devcenter.heroku.com/categories/java
I've been looking around all morning, and can't seem to figure this one out. I know it's not as complicated as I think it is, and all I need is just some pointers to the right direction.
I have an Android application that takes some user input, sends it to a Java application over the web, and then receives some output based on the input.
My Android and Java applications are ready, but how do I go about sending and receiving the data over the web? I understand that I'll be sending and receiving HTTP requests, but my problem is where I'll be sending them and receiving them from. Do I host my Java application on a Servlet like Tomcat, or do I use something like OpenShift to host my application for me?
I have no trouble with sending some HTTP request from my Android application to the web and receiving some output back, but my problem is that my web service needs to use a Java library to process the input and generate the output. I'm just not sure how I'm supposed to get this data to and from this Java library that needs to be hosted on the web.
I hope my question makes any sense.
EDIT: Perhaps I wasn't clear with what exactly I need help with. I do realize that the architecture I use doesn't really make any difference, but the problem I have is with how I'm supposed to use this architecture.
Let's say I have a registered domain name that I can easily send to and receive data from using my Android application - no trouble with that. But how am I supposed to integrate my Java library with this server? Do I just create an applet and put it on my server? Does my web host even allow Java applets to run?
I guess my question is how I'm supposed to get through the "barrier" between my HTTP request / transport layer protocol and my Java application.
Server architecture usually does not matter. You can use Java, NodeJs, Rails, Python, .NET, etc. You just need an endpoint that accepts a HTTP POST/PUT/GET/DELETE/PATCH verb.
This is more a question of "how do I set up a server to accept input" and its a very large topic in itself. I would advise you look at PAAS solutions like:
Parse.com
Kinvey.com
You can use their tools to build a solution fairly quickly. If you need something custom you'll need to build your backend in the language of choice and host it online via AWS, Google Cloud, Heroku, a VPS or something similar.
I have following requirements:
User comes on website and posts a request for a task.
There are multiple machines(clients) running an installed software(not web browser) which can perform the task.
web server has to ask these clients, whether they are willing to complete the task. I want the web server to be running on aws.
Here is what I have understood so far:
client can be a java socket client.
There can be a socket server on aws.
webserver talks to socket server and asks it to talk to socket client and get the response back.
other option might be to use websocket, but I need the client to be a installed software not a browser. Can the need of server socket be eliminated in this case?
Please suggest the best approach. Link to some tutorials will be very helpful or atleast I know what to google.
Thanks
I would suggest using RMI (Remote Method invocation) it is robust and seems fitted for what you are trying to accomplish:
http://en.wikipedia.org/wiki/Java_remote_method_invocation
I would also suggest using LipeRMI, which is a good, easy to follow RMI library.
Here is a good link to give you a quick idea on how it works and what your code would look like: http://lipermi.sourceforge.net/documentation.php
It would allow you to call methods on the server and send/receive serialized objects. Only thing is, if you need to do stuff like file transfer, this wouldnt work it only works with java objects.
I need to write an application in java which communicates with a web server.
I know how to do that, using PHP, but I'm afraid it won't cut it in this one.
Here's my situation.
I have multiple clients, when one of them sends a specific message to the server (so far, no problem on PHP), I want it to send a certain message to all other connected clients.
The problem is, I could hardly find any information regarding server socket in PHP, which led me to believe this isn't the proper way of achieving that. I'm using a paid hosting (x10premium) to host my servers so far, so I was thinking of doing it with this one, however, I'm not sure it's even possible with PHP.
At the moment I'm having each of the clients periodically check with the server if he received a message from any of the other clients, but I don't like this solution...
I hope someone could point me to the right direction. I don't know too much about Ruby and other languages which are used to do stuff like that, But if necessary, I would gladly learn it.
Thanks in advance
EDIT:
Forgot to mention, the server (currently the PHP) would also communicate with a MySQL table. If it matters.
This is a good example of PHP socket server/client:
http://tech.navarr.me/2010/07/how-to-create-a-socket-server-in-php.html
You could do it just like with JAVA, but remember that PHP does not support multithreading or multiprocessing so if 10 clients connect at once to your server, you will process them one by one, so eventually 1 will have to wait for the other 9 to finish - everything, database and connection overhead.
If you do it with JAVA or Python for example, you could handle each request in separate thread so that DB & Network communication overhead is handled simultaneosly.
Python has build in socket server components and nice and easy to use mysql component, that would make it a breez to achieve this, without even having to understand threading at all.
For the python socket server see here:
http://docs.python.org/library/socketserver.html
Basically you just define a function that will be executed for each new client connection and tell the server to serve_forever() - until it dies, it will do what you want.
I developed a chat application using java.But now my challenge is build a chat app in web application.I dont how to proceed.Can we use sockets as done in java.
Please give me a suggestion to get through this.
Thanks in Advance.
I recommend you to use websockets as they're really efficient to exchange in real time (push instead of pull) data between a server and html clients. They're bidirectionnal and roughly equivalent to the sockets you're used to (hence their name). Client-side, they use the same callback based logic than ajax clients but that doesn't mean they're not fast.
Here's a tutorial : http://java.dzone.com/articles/creating-websocket-chat
Googling "java chat websocket" would give you other results.