Without knowing the requirements for the application, here is the mostly likely way I would approach the problem, then. - Create the BST in the main thread, and pass a pointer to it as part of each thread's data (using appropriate protection -- either critical sections or a reading-sempaphore-type setup). - After Accept is called (spawning the new connection), the thread first checks the BST to see if the IP for the connection is bad. If it is, it closes the connection immediately; if not, it continues on. You could also use a hash table instead of a BST and have the IP be the key, and a something useful as the value (e.g. the number of failed connections?). This would decrease your searching time even more.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac