Java Code Examples for android.net.LocalSocket#bind()

The following examples show how to use android.net.LocalSocket#bind() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrafficMonitorThread.java    From ShadowsocksRR with Apache License 2.0 6 votes vote down vote up
/**
 * init server socket
 *
 * @return init failed return false.
 */
private boolean initServerSocket() {
    // if not running, do not init
    if (!isRunning) {
        return false;
    }

    try {
        LocalSocket localSocket = new LocalSocket();
        localSocket.bind(new LocalSocketAddress(PATH, LocalSocketAddress.Namespace.FILESYSTEM));
        serverSocket = new LocalServerSocket(localSocket.getFileDescriptor());
        return true;
    } catch (IOException e) {
        VayLog.e(TAG, "unable to bind", e);
        return false;
    }
}
 
Example 2
Source File: ShadowsocksVpnThread.java    From ShadowsocksRR with Apache License 2.0 6 votes vote down vote up
/**
 * init server socket
 *
 * @return init failed return false.
 */
private boolean initServerSocket() {
    // if not running, do not init
    if (!isRunning) {
        return false;
    }

    try {
        LocalSocket localSocket = new LocalSocket();
        localSocket.bind(new LocalSocketAddress(PATH, LocalSocketAddress.Namespace.FILESYSTEM));
        serverSocket = new LocalServerSocket(localSocket.getFileDescriptor());
        return true;
    } catch (IOException e) {
        VayLog.e(TAG, "unable to bind", e);
        app.track(e);
        return false;
    }
}
 
Example 3
Source File: TrafficMonitorThread.java    From Maying with Apache License 2.0 6 votes vote down vote up
/**
 * init server socket
 *
 * @return init failed return false.
 */
private boolean initServerSocket() {
    // if not running, do not init
    if (!isRunning) {
        return false;
    }

    try {
        LocalSocket localSocket = new LocalSocket();
        localSocket.bind(new LocalSocketAddress(PATH, LocalSocketAddress.Namespace.FILESYSTEM));
        serverSocket = new LocalServerSocket(localSocket.getFileDescriptor());
        return true;
    } catch (IOException e) {
        VayLog.e(TAG, "unable to bind", e);
        return false;
    }
}
 
Example 4
Source File: ShadowsocksVpnThread.java    From Maying with Apache License 2.0 6 votes vote down vote up
/**
 * init server socket
 *
 * @return init failed return false.
 */
private boolean initServerSocket() {
    // if not running, do not init
    if (!isRunning) {
        return false;
    }

    try {
        LocalSocket localSocket = new LocalSocket();
        localSocket.bind(new LocalSocketAddress(PATH, LocalSocketAddress.Namespace.FILESYSTEM));
        serverSocket = new LocalServerSocket(localSocket.getFileDescriptor());
        return true;
    } catch (IOException e) {
        VayLog.e(TAG, "unable to bind", e);
        ShadowsocksApplication.app.track(e);
        return false;
    }
}