h1. BanningFiltering IPs h2. Example 1 This example shows how to prevent a connection being made to the IPAddress '192.168.0.5'
private void BanPeer (ClientEngine engine)
{
// Hook up a handler to the 'BanPeer' event. This is raised
// every time a connection is received or an outgoing connection
// is about to be created. If you wish to close/abort the connection
// just set "BanPeer" to true.
engine.ConnectionManager.BanPeer += delegate(object sender, AttemptConnectionEventArgs e) {
if (e.Peer.ConnectionUri.Host == "192.168.0.5")
e.BanPeer = true;
};
}