Code example for SocketChannel

Methods: configureBlocking, register, socket

0
key.cancel();
			return; 
		} 
		 
		if (HostGateway.hasPending(channel.socket().getInetAddress().getHostAddress()))
		{ 
			System.out.println("Denied host: " + channel.socket().getInetAddress().getHostAddress());
			key.cancel();
			return; 
		} 
		 
		channel.configureBlocking(false);
		SelectionKey clientKey = channel.register(key.selector(), SelectionKey.OP_READ);
		Player player = new Player(new Client(clientKey));
		System.out.println("Incoming connection from " + player.session().client().host());
	} 
	 
	private static void network() 
	{ 
		try