             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). Peers(n=\(self.peers.count)) after adding")
+            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)

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

import CocoaAsyncSocket // NOTE: requires pod CocoaAsyncSocket
import HHServices
import dnssd
import xaphodObjCUtils

let kDNSServiceInterfaceIndexP2PSwift = UInt32.max-2
let iOS_wifi_interface = "en0"

// "Any" means can be both a client and a server. If accepting a new connection from another peer, that peer is deemed a client. If found an advertising .any peer, that peer is considered a server.
@objc public enum RoleType: Int, CustomStringConvertible {
