Part 2: implement socket filter