add the tcp segment handling (by永昌)