当前位置: 首页>>代码示例>>Java>>正文


Java LocalServerSocket.accept方法代码示例

本文整理汇总了Java中android.net.LocalServerSocket.accept方法的典型用法代码示例。如果您正苦于以下问题:Java LocalServerSocket.accept方法的具体用法?Java LocalServerSocket.accept怎么用?Java LocalServerSocket.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.net.LocalServerSocket的用法示例。


在下文中一共展示了LocalServerSocket.accept方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
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);
	}
 
开发者ID:ghazi94,项目名称:Android_CCTV,代码行数:20,代码来源:MediaStream.java

示例2: init

import android.net.LocalServerSocket; //导入方法依赖的package包/类
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);
}
  }
 
开发者ID:cmusatyalab,项目名称:faceswap,代码行数:18,代码来源:CameraConnector.java

示例3: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
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(1000000);
		mReceiver.setSoTimeout(3000);
		mSender = mLss.accept();
		mSender.setSendBufferSize(1000000);
	}
 
开发者ID:Oo-Dev,项目名称:OoDroid2,代码行数:20,代码来源:MediaStream.java

示例4: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
protected void createSockets() throws IOException {

		final String LOCAL_ADDR = "edu.ucsb.cs.capstone.letmypeoplecode.smartrover.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);
	}
 
开发者ID:sciencectn,项目名称:SmartRover,代码行数:20,代码来源:MediaStream.java

示例5: LocalProxySocket

import android.net.LocalServerSocket; //导入方法依赖的package包/类
public LocalProxySocket(Socket original) throws TorException {
    super();
    try {
        // Prepare LocalSocket which will be used to trick the SSLSocket (or any other one)
        localSocketSend = new LocalSocket();
        // Local socket name
        String socketName = "local" + UUID.randomUUID();
        localServerSocket = new LocalServerSocket(socketName);
        localSocketSend.connect(new LocalSocketAddress(socketName));
        localSocketRecv = localServerSocket.accept();
        this.originalSocket = original;
        // Create 2 Threads which are taking care of the communication between the LocalSocket and the original Socket
        LocalProxyWorker lpw1 = new LocalProxyWorker(localSocketRecv.getInputStream(), originalSocket.getOutputStream(), "to");
        LocalProxyWorker lpw2 = new LocalProxyWorker(originalSocket.getInputStream(), localSocketRecv.getOutputStream(), "from");
        Thread t1 = new Thread(lpw1);
        Thread t2 = new Thread(lpw2);
        t1.start();
        t2.start();
        // Prepare this Socket to contain the FileDescriptor of the LocalSocket
        FileDescriptor fd = localSocketSend.getFileDescriptor();
        SocketImpl socketImpl = (SocketImpl) Class.forName("java.net.PlainSocketImpl").getConstructor(FileDescriptor.class).newInstance(fd);
        Field implField = this.getClass().getSuperclass().getDeclaredField("impl");
        implField.setAccessible(true);
        implField.set(this, socketImpl);
    } catch (Exception e) {
        LOG.debug("Got Exception while trying to create LocalProxySocket", e);
        throw new TorException("could not create LocalProxySocket", e);
    }
}
 
开发者ID:B4dT0bi,项目名称:silvertunnel-ng,代码行数:30,代码来源:LocalProxySocket.java

示例6: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
protected void createSockets() throws IOException {

		if (sPipeApi == PIPE_API_LS) {
			
			final String LOCAL_ADDR = "com.galuu.ev3videocontrol.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]);
		}
	}
 
开发者ID:galme,项目名称:ROLF-EV3,代码行数:29,代码来源:MediaStream.java

示例7: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
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]);
		}
	}
 
开发者ID:hypeapps,项目名称:Endoscope,代码行数:29,代码来源:MediaStream.java

示例8: runIOLooper

import android.net.LocalServerSocket; //导入方法依赖的package包/类
/**
 * Loops on the local socket, handling emulator connection attempts.
 */
private void runIOLooper() {
    if (DEBUG) Log.d(TAG, "In SdkControllerConnection I/O looper.");
    do {
        try {
            // Create non-blocking server socket that would listen for connections,
            // and bind it to the given port on the local host.
            mServerSocket = new LocalServerSocket(SDK_CONTROLLER_PORT);
            LocalServerSocket socket = mServerSocket;
            while (socket != null) {
                final LocalSocket sk = socket.accept();
                if (mServerSocket != null) {
                    onAccept(sk);
                } else {
                    break;
                }
                socket = mServerSocket;
            }
        } catch (IOException e) {
            Loge("Exception " + e + "SdkControllerConnection I/O looper.");
        }
        if (DEBUG) Log.d(TAG, "Exiting SdkControllerConnection I/O looper.");

      // If we're exiting the internal loop for reasons other than an explicit
      // disconnect request, we should reconnect again.
    } while (disconnect());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:Connection.java

示例9: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
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]);
		}
	}
 
开发者ID:quanhua92,项目名称:libstreaming_android_studio,代码行数:29,代码来源:MediaStream.java

示例10: createSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
protected void createSockets() throws IOException {

		if (sPipeApi == PIPE_API_LS) {
			
			final String LOCAL_ADDR = "com.jjcamera.apps.iosched.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]);
		}
	}
 
开发者ID:xunboo,项目名称:JJCamera,代码行数:29,代码来源:MediaStream.java

示例11: run

import android.net.LocalServerSocket; //导入方法依赖的package包/类
public void run() {
    try {
        for (; ; ) {
            LocalServerSocket serverSocket = Server.this.mServerSocket;
            if (serverSocket == null) {
                break;
            }
            LocalSocket socket = serverSocket.accept();
            if (Log.isLoggable("InstantRun", 2)) {
                Log.v("InstantRun", "Received connection from IDE: spawning connection thread");
            }
            Server.SocketServerReplyThread socketServerReplyThread = new Server.SocketServerReplyThread(socket);

            socketServerReplyThread.run();
            if (Server.sWrongTokenCount > 50) {
                if (Log.isLoggable("InstantRun", 2)) {
                    Log.v("InstantRun", "Stopping server: too many wrong token connections");
                }
                Server.this.mServerSocket.close();
                break;
            }
        }
    } catch (Throwable e) {
        if (Log.isLoggable("InstantRun", 2)) {
            Log.v("InstantRun", "Fatal error accepting connection on local socket", e);
        }
    }
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:29,代码来源:Server.java

示例12: initializeLocalSocket

import android.net.LocalServerSocket; //导入方法依赖的package包/类
private boolean initializeLocalSocket(){
	receiver = new LocalSocket();
	try {
		lss = new LocalServerSocket("VideoCamera");
		receiver.connect(new LocalSocketAddress("VideoCamera"));
		receiver.setReceiveBufferSize(500000);
		receiver.setSendBufferSize(500000);
		sender = lss.accept();
		sender.setReceiveBufferSize(500000);
		sender.setSendBufferSize(500000);
	} catch (IOException e) {
		return false;
	}
	return true;
}
 
开发者ID:jwzhuang,项目名称:Android_H264Stream,代码行数:16,代码来源:RecordService.java

示例13: initLocalSocket

import android.net.LocalServerSocket; //导入方法依赖的package包/类
private void initLocalSocket() {
    LocalSocket receiver = new LocalSocket();
    try {
        LocalServerSocket lss = new LocalServerSocket("H264");
        receiver.connect(new LocalSocketAddress("H264"));
        receiver.setReceiveBufferSize(500000);
        receiver.setSendBufferSize(500000);
        sender = lss.accept();
        sender.setReceiveBufferSize(500000);
        sender.setSendBufferSize(500000);
    } catch (IOException e1) {
        e1.printStackTrace();
    }
}
 
开发者ID:rednels,项目名称:Android-Sample,代码行数:15,代码来源:TextureViewActivity.java

示例14: createLocalSockets

import android.net.LocalServerSocket; //导入方法依赖的package包/类
protected void createLocalSockets() throws IOException {
	Log.d(LOG_TAG, "Binding to " + localName());
	serverSocket = new LocalServerSocket(localName());
	receiverSocket = new LocalSocket();
	receiverSocket.connect(new LocalSocketAddress(localName()));
	receiverSocket.setReceiveBufferSize(BUFFER_SIZE);
	receiverSocket.setSoTimeout(SO_TIMEOUT);
	senderSocket = serverSocket.accept();
	senderSocket.setSendBufferSize(BUFFER_SIZE);
}
 
开发者ID:mywebio,项目名称:mywebio-sdk,代码行数:11,代码来源:StreamingService.java

示例15: onResume

import android.net.LocalServerSocket; //导入方法依赖的package包/类
@Override
  public void onResume() {
if (!Sipdroid.release) Log.i("SipUA:","on resume");
      justplay = intent.hasExtra("justplay");
      if (!justplay) {
	receiver = new LocalSocket();
	try {
		lss = new LocalServerSocket("Sipdroid");
		receiver.connect(new LocalSocketAddress("Sipdroid"));
		receiver.setReceiveBufferSize(500000);
		receiver.setSendBufferSize(500000);
		sender = lss.accept();
		sender.setReceiveBufferSize(500000);
		sender.setSendBufferSize(500000);
	} catch (IOException e1) {
		if (!Sipdroid.release) e1.printStackTrace();
		super.onResume();
		finish();
		return;
	}
       checkForCamera();
          mVideoPreview.setVisibility(View.VISIBLE);
       if (!mMediaRecorderRecording) initializeVideo();
       startVideoRecording();
      } else if (Receiver.engine(mContext).getRemoteVideo() != 0 && PreferenceManager.getDefaultSharedPreferences(this).getString(org.sipdroid.sipua.ui.Settings.PREF_SERVER, org.sipdroid.sipua.ui.Settings.DEFAULT_SERVER).equals(org.sipdroid.sipua.ui.Settings.DEFAULT_SERVER)) {
      	mVideoFrame.setVideoURI(Uri.parse("rtsp://"+Receiver.engine(mContext).getRemoteAddr()+"/"+
      		Receiver.engine(mContext).getRemoteVideo()+"/sipdroid"));
      	mVideoFrame.setMediaController(mMediaController = new MediaController(this));
      	mVideoFrame.setOnErrorListener(this);
      	mVideoFrame.requestFocus();
      	mVideoFrame.start();
      }

      mRecordingTimeView.setText("");
      mRecordingTimeView.setVisibility(View.VISIBLE);
      mHandler.removeMessages(UPDATE_RECORD_TIME);
      mHandler.sendEmptyMessage(UPDATE_RECORD_TIME);
      super.onResume();
  }
 
开发者ID:bigbn,项目名称:phonty,代码行数:40,代码来源:VideoCamera.java


注:本文中的android.net.LocalServerSocket.accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。