         if let socket = self.serverSocket {
             DLog("serviceDidPublish: USING EXISTING SERVERSOCKET \(socket)")
         } else {
-            self.serverSocket = GCDAsyncSocket.init(delegate: self, delegateQueue: socketQueue)
-            self.serverSocket?.isIPv4PreferredOverIPv6 = false
-            guard let serverSocket = self.serverSocket else {
-                DLog("ERROR - Could not create serverSocket")
-                return
-            }
-            
-            do {
-                try serverSocket.accept(onPort: serverPort)
-            } catch {
-                DLog("ERROR accepting on serverSocket")
+            if self.createServerSocket() == false {
                 return
             }
         }

    }
    
    func isWifiInterface() -> Bool {
        return self.interfaceName == "en0"
    }
    
    func socketAsData() -> Data {

            newPeer.state = .awaitingAuth
            newPeer.role = .client
            newPeer.socket = newSocket
            newPeer.lastInterfaceName = XaphodUtils.interfaceName(ofLocalIpAddress: newSocket.localHost!)
            
            self.peers.append(newPeer) // always add as a new peer, even if it already exists. This might result in a dupe if we are browsing and advertising for same service. The original will get removed on receiving the name of other device, if it matches
            DLog("accepting new connection from \(connectedHost) on \(newPeer.lastInterfaceName). Peers(n=\(self.peers.count)) after adding")
            
            // CONVENTION: CLIENT sends SERVER 32 bytes of its name -- UTF-8 string
            newSocket.readData(toLength: 32, withTimeout: Timeouts.header.rawValue, tag: DataTag.tag_NAME.rawValue)
