Originally Posted by skarosg3
If I may, I'd like to take a step back from the code and talk about server theory. There are a lot of acronyms and paradigms surrounding servers but ultimately they all fall into one of two broad categories; services and streams. For streams, think a continuos flow of information; games, maps and real-time data. For services think discrete chunks of information; websites, database queries, a list of Facebook friends.
It sounds to me that you want a service. The client requests something from the server and receives a result. Alternatively the client updates the server with a package of information and the server updates it's internal state.
If this feels like what you need start reading up on REST
ful web services. Here is how they work:
- The server exposes resources on top of the HTTP stack. In lay terms an address such as http://www.mydomain.com/people will respond to this URI request with information about people.
- The client sends standard HTTP headers such as GET or POST with parameters for the server, such as the name of the person the client is interested in.
- The server responds to the clients request. Typically the response is JSON for cross platform compatibility but it can be anything; XML, CVS, binary, it really doesn't matter.
REST servers are pretty cool. They are stateless and loosely coupled with the client. So at any point in time, any client (Android, iOS or standard website) can request or update data with only one client side consideration; was the request successful or wasn't it. They are also indempotent meaning it will respond with the same result no matter how often the call is made.
However, in the industry these web services are typically written in PHP or ASP.NET. I have zero experience with a Java RESTful web service so my advice on the matter ends here.