Android TCP client example

For new multiplayer social game I created simple TCP client as Android application. It connects to special echo server (.NET) and sends/receives packets to/from other clients. Packets are UTF-8 text messages prefixed by string length 4-bytes integer as a header of the packet.

Android-tcp-client

I used Java NIO to implement network layer with second worker thread to wait for connection establishment and further reading of incoming packets. Network layer is separated of GUI, so, ready to be used in other Android application. Eclipse project, .NET server and client for tests are here.

 

Advertisements
1 comment
  1. Rodrigo Basniak said:

    Thank you so much… keep up the good working on the blog. Cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: