implement core of adtcp