Java Code Examples for android.net.LocalSocket#setReceiveBufferSize()

The following examples show how to use android.net.LocalSocket#setReceiveBufferSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraConnector.java    From faceswap with Apache License 2.0 6 votes vote down vote up
public void init() {
      try {
          localLoop = new LocalServerSocket("videoserver");
          localReceiver = new LocalSocket();
          localReceiver.connect(localLoop.getLocalSocketAddress());
          localReceiver.setReceiveBufferSize(LOCAL_BUFF_SIZE);
          localReceiver.setSendBufferSize(LOCAL_BUFF_SIZE);
	
	localSender = localLoop.accept();
          localSender.setReceiveBufferSize(LOCAL_BUFF_SIZE);
          localSender.setSendBufferSize(LOCAL_BUFF_SIZE);
	
          Log.d(LOG_TAG, "Done: init()");
}catch(IOException e) {
    Log.e(LOG_TAG, "Error in initializing local socket: " + e);
}
  }
 
Example 2
Source File: MediaStream.java    From spydroid-ipcamera with GNU General Public License v3.0 6 votes vote down vote up
protected void createSockets() throws IOException {

		final String LOCAL_ADDR = "net.majorkernelpanic.streaming-";

		for (int i=0;i<10;i++) {
			try {
				mSocketId = new Random().nextInt();
				mLss = new LocalServerSocket(LOCAL_ADDR+mSocketId);
				break;
			} catch (IOException e1) {}
		}

		mReceiver = new LocalSocket();
		mReceiver.connect( new LocalSocketAddress(LOCAL_ADDR+mSocketId));
		mReceiver.setReceiveBufferSize(500000);
		mReceiver.setSoTimeout(3000);
		mSender = mLss.accept();
		mSender.setSendBufferSize(500000);
	}
 
Example 3
Source File: MediaStream.java    From libstreaming with Apache License 2.0 5 votes vote down vote up
protected void createSockets() throws IOException {

		if (sPipeApi == PIPE_API_LS) {
			
			final String LOCAL_ADDR = "net.majorkernelpanic.streaming-";
	
			for (int i=0;i<10;i++) {
				try {
					mSocketId = new Random().nextInt();
					mLss = new LocalServerSocket(LOCAL_ADDR+mSocketId);
					break;
				} catch (IOException e1) {}
			}
	
			mReceiver = new LocalSocket();
			mReceiver.connect( new LocalSocketAddress(LOCAL_ADDR+mSocketId));
			mReceiver.setReceiveBufferSize(500000);
			mReceiver.setSoTimeout(3000);
			mSender = mLss.accept();
			mSender.setSendBufferSize(500000);
			
		} else {
			Log.e(TAG, "parcelFileDescriptors createPipe version = Lollipop");
			mParcelFileDescriptors = ParcelFileDescriptor.createPipe();
			mParcelRead = new ParcelFileDescriptor(mParcelFileDescriptors[0]);
			mParcelWrite = new ParcelFileDescriptor(mParcelFileDescriptors[1]);
		}
	}