There is such C ++ code in the NDK:

{ boost::asio::io_service ios; boost::asio::ip::tcp::socket sock(ios); boost::system::error_code ec; boost::asio::ip::tcp::endpoint ep(boost::asio::ip::address::from_string("xx.xx.xx.xx"), 44550); sock.connect(ep, ec); LOGI("out2: ec=%s\n", ec.message().c_str()); } 

But in the output I get: out2: ec=Network is unreachable

If this code is compiled and run on a PC, everything is OK.

The application manifest specifies <uses-permission android:name="android.permission.INTERNET" />

Ideas?

ps I test on the emulator.

psps as NDK is used crystax-ndk-10.3.2-linux-x86_64

  • Can you see the IP address of your device in the emulator? - user1056837
  • @ user1056837 how to do this? - tasheehoo
  • go to the network settings in the emulated device and there will be an IP address. - user1056837
  • @ user1056837 a, you about it. says that Unavailable . - tasheehoo
  • As I understand it, you cannot go from the browser in the emulator either. So? - user1056837

0