0

I want to send some data in form of continuous strings from a visual c++ program to an android app via wifi. I'm trying to make a tcp server that sends the data continuously. What c++ library should I use for this which will be easy to use and won't require some library on the android side for decoding etc.? I have already coded the android client part that receives the strings (I used an existing server app to test it out). Here's the relevant part of the android code -

class ServerThread implements Runnable {
    @Override
    public void run() {
        Socket s = null;

        try {
            Log.d("TAG", "connecting to server");               
            s = new Socket("192.168.56.1", 1337);
            BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream()));
            while(true){
                String line = input.readLine();}
Loïc Faure-Lacroix
  • 13,220
  • 6
  • 67
  • 99
abhishek
  • 817
  • 6
  • 19
  • 33

2 Answers2

2

The library of choice for me is boost asio. http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio.html

The tutorials are suitable for what you have in mind.

beardedN5rd
  • 185
  • 6
0

Boost asio is a great networking library for general purposes.

Take a look at this question

Best C/C++ Network Library - Already asked question

about good networking libraries.

Assuming you want to go with boost, this may help you

Android NDK: Including boost c++ library

Community
  • 1
  • 1
Austin J.
  • 138
  • 6