Better maintain socket IDs

Better maintain socket IDs