Code example for LocalSocket

Methods: connect, getInputStream, getOutputStream

0
 
	// end by yuejun 20120829 SATA differs from USB 
 
	public void connect() { 
		try { 
			s = new LocalSocket();
			l = new LocalSocketAddress(SOCKET_NAME,
					LocalSocketAddress.Namespace.RESERVED);
			s.connect(l);
			is = s.getInputStream();
			os = s.getOutputStream();
			Log.i(TAG, os.toString());
 
		} catch (IOException e) {
			Log.e(TAG, "connect error", e);
			//e.printStackTrace(); 
		} 
 
	}