implemented TCP search alg