Dynamic port management