Code example for SocketChannel

Methods: socketconfigureBlocking

	public Communication(String ipAddress, int port, Handler messageHandler) { 
		try { 
			SocketAddress address = new InetSocketAddress(ipAddress, port); 
			this.socketChannel =; 
		} catch (IOException e) { 
			Log.e("SOUTILS", "An error occurred while setting up a new communication", e); 
		this.clientAddress = this.socketChannel.socket().getInetAddress().getHostAddress(); 
		this.messageHandler = messageHandler; 
	 * Creates a new client communication thread with a host device. As for any Java thread this thread needs to be 
	 * started using the {@link #run()} method. 
	 * @param socketChannel the socketChannel to be used during the communication 
	 * @param messageHandler the handler to which received messages are forwarded. See {@link #run()} for more details 
	 * @see #run()