added logic for REP, DEALER, ROUTER sockets