socket: remove some common functions from Socket protocol