Code example for LocalSocket

Methods: connect, getInputStream, getOutputStream

0
	public boolean isConnected() { 
		return mSocket != null && mSocket.isConnected();
	} 
	 
	public void connect() throws IOException { 
		mSocket = new LocalSocket();
		mSocket.connect(new LocalSocketAddress(mAdminSockPath,
				LocalSocketAddress.Namespace.FILESYSTEM));
		mOs = mSocket.getOutputStream();
		mIs = mSocket.getInputStream();		
	} 
	 
 
	public void send(ByteBuffer bb) throws IOException {
		Log.i("ipsec-tools", "send: " + bb);
		mOs.write(bb.array());
	} 
	 
	public Command receive() throws IOException { 
		return Command.receive(mIs);
	}