Restrict the Client if the client already opened 50 connection

Want to restrict the Client if the same client IP already opened 50 connections. so kindly help to achieve the above requirement.

Here is your answer: