This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Multiple connection in mesh net

Hi guys , i'm using nRF mesh library  nRFMeshProvision 2.2.3. I'm trying to connect to multiple mesh nodes and send message to all of them. In provided class NetworkConnection.swift i see next words:

// Find the first connected proxy. This may be modified to find
// the closes one, or, if needed, the message can be sent to all
// connected nodes.



so i implemented my idea like this 

func send(_ data: Data, ofType type: PduType) throws {
    guard supports(type) else {
        throw BearerError.pduTypeNotSupported
    }
    
    proxies.forEach {
        if ($0.isOpen) {
            do {
                try $0.send(data, ofType: type)
            } catch  {
            }
        }
    }

    //***** this is original implementation that send message to the first open node 
    //        guard let proxy = proxies.first(where: { $0.isOpen }) else {
    //            throw BearerError.bearerClosed
    //        }
    //        try proxy.send(data, ofType: type)
}


Is it correct way to achieve my goal? I'm asking because sometimes i get crash



Thank you
Parents Reply
    • It makes sense to send a message directly to the destination node, or one that's close to it with small ttl value, as then the message isn't propagated via adv bearer or just with few hops. But sending the same message to multiple nodes not knowing which is them, if any, is the target is not needed. Each of those Nodes will relay the message immediately on adv bearer, so all other nodes in range will get it moment later. There is of course more lag, or risk with losing a packet, but that could be fixed by increasing Network Transmit and Relay Retransmit properties on Proxy nodes. That should be enough.
Children
No Data
Related