Code example for ServerSocket

Methods: accept, close

0
 
	public void run() { 
 
		try { 
 
			Socket client = socket.accept();
			Log.d(TAG, "Server socket now accepting clients");
			currentclient = new RobotClients(client, rbtNet);
			Log.d(TAG, "Client accepted");
			socket.close();
			Log.d(TAG, "Server socket closed");
 
		} catch (IOException e) {
			e.printStackTrace();
		} 
 
	} 
	public void close(){ 
		if(currentclient!=null){
			currentclient.terminate();
		}