Android Open Source - android-melogsta Socket I P C Client






From Project

Back to project page android-melogsta.

License

The source code is released under:

GNU General Public License

If you think the Android project android-melogsta listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.uvwxy.melogsta;
//  www  .j  ava2  s  .  com
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;

import android.net.LocalSocket;
import android.net.LocalSocketAddress;

public class SocketIPCClient {
  private int prio = -1;
  private int pid = -1;

  public SocketIPCClient(int priority, int pid) {
    this.prio = priority;
    this.pid = pid;
  }

  public ArrayList<LogHistoryItem> getRemoteLogList() {
    LocalSocket client = new LocalSocket();
    ArrayList<LogHistoryItem> result = null;
    try {
      client.connect(new LocalSocketAddress(SocketIPCServer.SOCKET_ADDRESS_PREFIX + pid));

      DataOutputStream output = new DataOutputStream(client.getOutputStream());
      output.writeInt(prio);

      ObjectInputStream input = new ObjectInputStream(client.getInputStream());
      result = (ArrayList<LogHistoryItem>) input.readObject();

      output.close();
      input.close();
      client.close();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }

    return result;
  }
}




Java Source Code List

de.uvwxy.melogsta.ActivityShowLogs.java
de.uvwxy.melogsta.LogHistoryItemArrayAdapter.java
de.uvwxy.melogsta.LogHistoryItem.java
de.uvwxy.melogsta.LogNotification.java
de.uvwxy.melogsta.LogTypeState.java
de.uvwxy.melogsta.Log.java
de.uvwxy.melogsta.SocketIPCClient.java
de.uvwxy.melogsta.SocketIPCServer.java