Android LocalServerSocket - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android LocalServerSocket class.

This code example shows how to use the following methods:
 
	public StreamingLoop (String addr)	
	{ 
		localAddress = addr;
        try { 
			lss = new LocalServerSocket(localAddress);
		} catch (IOException e) {
			e.printStackTrace();
		}		 
	} 
	 
    public InputStream getInputStream() throws IOException{
       return receiver.getInputStream(); 
    } 
 
    public OutputStream getOutputStream() throws IOException{
       return sender.getOutputStream();
    } 
 
	public void ReleaseLoop() 
6
CodeRank
This code example shows how to use the following methods:accept, close
 
	public void prepare() throws IllegalStateException, IOException { 
 
		receiver = new LocalSocket();
		try { 
			lss = new LocalServerSocket("Spydroid" + id);
			receiver.connect(new LocalSocketAddress("Spydroid" + id));
			receiver.setReceiveBufferSize(500000);
			receiver.setSendBufferSize(500000);
			sender = lss.accept();
			sender.setReceiveBufferSize(500000);
			sender.setSendBufferSize(500000);
			id++;
		} catch (IOException e1) {
			Log.e("MediaStreamer", "What ? It cannot be !!");
			return; 
		} 
 
		setOutputFile(sender.getFileDescriptor());
 

5
CodeRank
This code example shows how to use the following methods:accept, close
	 
	public void prepare() throws IllegalStateException,IOException { 
		 
		receiver = new LocalSocket();
		try { 
			lss = new LocalServerSocket("librtp-"+id);
			receiver.connect(new LocalSocketAddress("librtp-"+id));
			receiver.setReceiveBufferSize(500000);
			receiver.setSendBufferSize(500000);
			sender = lss.accept();
			sender.setReceiveBufferSize(500000);
			sender.setSendBufferSize(500000);
			id++;
		} catch (IOException e1) {
			MyLog.e("What ? It cannot be !!"); 
			return; 
		} 
		 
		setOutputFile(sender.getFileDescriptor());
		 

5
CodeRank
This code example shows how to use the following methods:
        } 
        Slog.i(TAG, "connecting...");
        try { 
            mSocket = new LocalSocket();
 
            LocalSocketAddress address = new LocalSocketAddress("installd",
                    LocalSocketAddress.Namespace.RESERVED);
 
            mSocket.connect(address);
 
            mIn = mSocket.getInputStream();
            mOut = mSocket.getOutputStream();
        } catch (IOException ex) {
            disconnect(); 
            return false; 
        } 
        return true; 
    } 
 
    private void disconnect() { 
7
CodeRank
This code example shows how to use the following methods:
        } 
        Slog.i(TAG, "connecting...");
        try { 
            mSocket = new LocalSocket();
 
            LocalSocketAddress address = new LocalSocketAddress("installd",
                    LocalSocketAddress.Namespace.RESERVED);
 
            mSocket.connect(address);
 
            mIn = mSocket.getInputStream();
            mOut = mSocket.getOutputStream();
        } catch (IOException ex) {
            disconnect(); 
            return false; 
        } 
        return true; 
    } 
 
    private void disconnect() { 
5
CodeRank
This code example shows how to use the following methods:
    private LocalServerSocket mServerSocket = null;
 
    @Override public void onCreate() { 
        Log.v(TAG, "onCreate");
        try { 
            mServerSocket = new LocalServerSocket(SOCKET_NAME);
        } catch (IOException e) {
            Log.v(TAG, "in onCreate, making server socket: " + e);
            return; 
        } 
 
        Thread t = new Thread() {
                @Override public void run() { 
                    LocalSocket socket = null;
                    while (true) { 
                        try { 
                            Log.v(TAG, "Waiting for connection...");
                            socket = mServerSocket.accept();
                            Log.v(TAG, "Got socket: " + socket);
                            if (socket != null) {
5
CodeRank
This code example shows how to use the following methods:
        } 
        Log.i(TAG, "connecting...");
        try { 
            mSocket = new LocalSocket();
 
            LocalSocketAddress address = new LocalSocketAddress(
                "installd", LocalSocketAddress.Namespace.RESERVED);
 
            mSocket.connect(address);
 
            mIn = mSocket.getInputStream();
            mOut = mSocket.getOutputStream();
        } catch (IOException ex) {
            disconnect(); 
            return false; 
        } 
        return true; 
    } 
 
	private void disconnect() { 
5
CodeRank
This code example shows how to use the following methods:
        int buffersize = 500000;
        try 
        { 
            // open local server socket and connect with receiving socket 
            lss = new LocalServerSocket("librtp-" + id);
            receiver.connect(new LocalSocketAddress("librtp-" + id));
 
            // Set receiver buffer sizes 
            receiver.setReceiveBufferSize(buffersize);
            receiver.setSendBufferSize(buffersize);
 
            // Connect the server and receiver sockets 
            sender = lss.accept();
 
            // Set sender buffer 
            sender.setReceiveBufferSize(buffersize);
            sender.setSendBufferSize(buffersize);
            id++;
        } catch (IOException e1)
        { 
4
CodeRank
This code example shows how to use the following methods:
        } 
        Slog.i(TAG, "connecting...");
        try { 
            mSocket = new LocalSocket();
 
            LocalSocketAddress address = new LocalSocketAddress(
                "installd", LocalSocketAddress.Namespace.RESERVED);
 
            mSocket.connect(address);
 
            mIn = mSocket.getInputStream();
            mOut = mSocket.getOutputStream();
        } catch (IOException ex) {
            disconnect(); 
            return false; 
        } 
        return true; 
    } 
 
	private void disconnect() { 
5
CodeRank
This code example shows how to use the following methods:
 
	public abstract String generateSessionDescription()  throws IllegalStateException, IOException;
 
	private void createSockets() throws IOException { 
		mReceiver = new LocalSocket();
		mReceiver.connect( new LocalSocketAddress("net.majorkernelpanic.librtp-" + mSocketId ) );
		mReceiver.setReceiveBufferSize(500000);
		mSender = mLss.accept();
		mSender.setSendBufferSize(500000); 
	} 
 
	private void closeSockets() { 
		try { 
			mSender.close();
			mReceiver.close();
		} catch (Exception ignore) {}
	} 
 
	/**  
	 * Releases ressources associated with the stream.  
4
CodeRank

Related Android LocalServerSocket Questions & Answers:

See Code Examples for Android LocalServerSocket Methods: