Code example for SocketChannel

Methods: configureBlocking

0
	} 
 
	public void connect() { 
		try { 
			channel = SocketChannel.open(new InetSocketAddress(host, port));
			channel.configureBlocking(false);
		} catch (IOException e) { e.printStackTrace(); }
		socket = new AsynchronousSocket(channel);
		IOLoop.INSTANCE.addHandler(channel, socket, SelectionKey.OP_READ, ByteBuffer.allocate(1024));
	} 
	 
	public void get(String value, AsyncResult<String> cb) {
		socket.write("GET deft\r\n", new WriteCallback(cb));
	} 
	 
	private class WriteCallback implements AsyncCallback { 
 
		private final AsyncResult<String> cb;
		 
		public WriteCallback(AsyncResult<String> cb) {