mdang mdang - 1 year ago 119
Android Question

libjingle talk_base::AsyncSocket() connect failed for Android due to access denied?

I am using the AsyncSocket source code from libjingle to connect to a server. I am using the same source code in an iPhone App and the connection is fine, but on the Android phone, I get access denied error when creating a socket.

This is the function that fails at s_ = ::socket(family, type, 0).

// Creates the underlying OS socket (same as the "socket" function).
virtual bool Create(int family, int type) {
s_ = ::socket(family, type, 0);
udp_ = (SOCK_DGRAM == type);
if (udp_)
enabled_events_ = DE_READ | DE_WRITE;
return s_ != INVALID_SOCKET;

The family value is 2 and type is 1. S_ gets a return value of -1 with errno of 13. I looked up Linux error code and it's access denied. Do you know if there is any special setting in Android that I need to set? Any help would be appreciated.

Answer Source


Specifically : <uses-permission android:name="android.permission.INTERNET" />

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download