Basic socket master/client func