efactoring socketswitching