Monday, May 5, 2014

Simple Android Client-Server Application

This is an android application which sends a text message to a server. When you press the send button, the application sends the message in the text field to the server program. Here the program been written so that the client runs on the Android emulator and the server runs on the local host. IP address 10.0.2.2  can be used to connect to the local host with Android. Server program is continuously listening to the port 4444. When an incoming message arrived, server read it and show it on the standard output.
This tutorial is based on Android 4.4 (API Level 19 - KITKAT) version.



Following are the source codes of main components.

Android Text Client Application




Java Sever Program



Following are the both Android client and Java server complete projects. You can clone or download them as zips from Git-Hub.

Git-Hub HTTPS clone URL: https://github.com/lakjcomspace/AndroidTextClientServer.git
Git-Hub Repository URL: https://github.com/lakjcomspace/AndroidTextClientServer
Download as a Zip: https://github.com/lakjcomspace/AndroidTextClientServer/archive/master.zip
You can run the projects by importing them to the IDE. Or just create you own project and copy and paste above source files.