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();}
2
  • Wouldn't it be easier to implement the part on the server in java? Since you have android already in java, you could reuse the code both ways. Commented Feb 7, 2014 at 5:19
  • I'm using opencv in my c++ code, so it has to be C++. Commented Feb 7, 2014 at 5:21

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.