move functions to common code
use #addr for address length now have __len
use #addr for address length now have __len
more shared functions; accept is special case as flags might be available