created packet catching function