Preparing socket connections