How can i keep an Android Device as Server - android

I had a client and a server type of mobile application. The server app is on a tablet and the client app is on several phone devices. Now I want a client-server communication with this tablet and other devices. The client app will send data to the tablet and retrieves data from the tablet. The server app will show the data inserted newly in its UI. How can I achieve this? It possible in android if then please give me a solution. I have googled a lot and read about socket programming. But I didn't find a proper solution to my question.

please refer the following links for help-
http://developer.android.com/reference/java/net/ServerSocket.html this is for server side http://developer.android.com/reference/java/net/Socket.html and for client side

Related

is it possible to send bits of data between two android mobiles over internet without a server?

I am developing an android application, in this I have a requirement. Data needs to be transferred between two android mobiles, the data is very small in bits.
I want to transfer data over internet, my doubts are:
Is it possible to do it without a server, like we send MMS without a server.
In my app data will be sent with the SMS, that data is attached to the SMS and transferred over internet
Technically yes. It is possible. But it is tough to develop generic application. You can do the Simple test program in your lab.
Steps:
Write a Socket program and open a port 80.
Find the IP of your mobile.
Open browser and type the IP.
You will get whatever your server sends.
Pls. check the following link.
Sample Android Client Server Program

Connect two android applications to send and receive data

I am developing a chatting app for android using phonegap , i have developed the UI but now im struck for how to connect two apps for sending and receiving data over internet, Messages in this case. I know this type of questions are not allowed on stackoverflow but im helpless.
Can anyone suggest what methodology or technology to use, i dont have a server all the data is stored locally in the mobile phone.
Thanks in advance.
Look at MQTT.
You can find references in http://www.eclipse.org/paho

Using your own XMPP server for android chat app (Smack API)

I am new to Android programming.I have completed the basics though and wish to learn XMPP for making a chat application on Android. I've gone through tutorials, but have not got the way to use a custom pc as server for the application.I want to use my laptop as a server for sending messages between 2 android devices.My laptop should be able to recieve and direct the messages between the two.Can anyone please help me get started?
First of all, you need to install in your laptop a XMPP server. Here are a list of available ones. People used to say Openfire is easy to install and configure, but to production purposes Ejabberd (linux and mac only) seems to be more robust.
To develop your app, you can use Smack, which is large well documented, with code snapshots to connect to a server, create a chat, send and receive messages etc.

Realtime P2P communication between mobile devices

I am building a mobile device that needs to send realtime information to other devices. I have considered XMPP but I do not have a server, so the communication must be only between the devices.
Is there a way to communicate using XMPP between mobile devices without a server (Or using the mobile devices as servers)?
Is Sockets a good idea ? i.e. Having a ServerSocket and client Socket and communicating this way.
Is there a smarter way? I have heard of jWebSocket but I dont really know how it works or if it's worth it.
EDIT
The process is as follows:
I'm using Parse as a server/backend http://parse.com
When the user runs the app, a user list is retrieved from the parse server
The user then has (Could have) the ip of other clients and then attempt to communicate with them.
Problems
1. Parse does not support a XMPP server or other type of servers
You might look at using an IRC client library like http://jerklib.wikia.com/wiki/JerkLib_Wiki. This way you can use a public IRC server to communicate with your other devices...
I've not used it, but I did bookmark it for further reading because I thought it a novel concept ...
I hope it helps...

for multiplayer online game: how to initiate data transfer by server and send data to android phone?

I'm very familiar with REST type of communication where the phone sends GET and POST messages to the server - essentially polling the server for updates. This worked well for apps where real-time data wasn't essential.
For a multiplayer game real-time data is essential; after a user has signed-in to the server the server needs to be able to send messages to the phone (instead of the phone asking for data).
Does anyone have any links to provide details on how this is done ?
Thanks to Selvin for pointing me to the "socket" keyword.
I've searched around and came up with the following online resources :
Incorporating Socket Programming into your Applications
http://thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/
Example: Android bi-directional network socket using AsyncTask
Example: Android bi-directional network socket using AsyncTask
If anyone has a book suggestion, please let me know with a comment.
You will need to implement Android Cloud to Device Messaging, Android's push technology, available on Android 2.2 and above.
http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html

Categories

Resources