Code example for LocalSocket

Methods: connect, getInputStream, getOutputStream

0
    public void StartClient() { 
        try { 
            //socket = new Socket("127.0.0.1", 37121); 
            //socket.setSoTimeout(10000); 
             
            socket = new LocalSocket();
            socket.connect(new LocalSocketAddress("EngineerModeServer"));//, LocalSocketAddress.Namespace.FILESYSTEM
 
            in = new DataInputStream(socket.getInputStream());
            out = new DataOutputStream(socket.getOutputStream());
 
        } catch (IOException e) {
            Log.e("EMX", "startclient EXP " + e.getMessage());
            if (e.getMessage().equals("Connection refused: connect")) {
                 
            } else if (e.getMessage().equals("Read timed out")) {
                
            } else { 
                 
            } 
            status = -1;