28 Oca [:en]Example Code Application vestek | 2. Advanced LAN/RS232 Commands | 0 Get socket messagenew Thread(new Runnable() { @Override public void run() { Log.i(TAG, "get socket message"); try { ServerSocket serverSocket = new ServerSocket(1987); while (!Thread.currentThread().isInterrupted()) { String msg = null; Socket socket = serverSocket.accept(); if (socket != null) { BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); while ((msg = input.readLine()) != null) { Log.i("TESTTOOL msg is ", msg); } } } } catch (IOException e) { e.printStackTrace(); } }}).start(); Send socket messagenew Thread(new Runnable() { @Override public void run() { try { Log.i(TAG, "send socket message"); Socket socket = new Socket("localhost", 1986); DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream()); byte[] bytes = new String("SETMUTE").getBytes(); outputStream.write(bytes); outputStream.flush(); outputStream.close(); socket.close(); } catch (Exception e) { e.printStackTrace(); } }}).start();