How do you limit connections per IP with winsock?
Lets say I wanted to limit them to 20 connections per IP then don't accept the connection once its reach the limit.
I can't think of the logic on doing this.
I've thought of using callbacks
on WSAAccept()
and log into a database each ip before accepting a connection and list it on the db for each connection made.
[check if column count is <= 20]
return CF_ACCEPT;
}else{
return CF_REJECT;
But is there a more efficient way of doing this?