set socket based on protocol