can't you do this with `lists:length(erlang:ports())`?