I am trying to make sort of a custom firewall program which will block specified ips.

I currently have a way to obtain the list of the ips that are connected to my computer, but i can't seem to find a way to actually disconnect that ip.