Hello,
I do have a Hardware device which receives the data at port 1235 and sending at port 1234.
Now the iOS app has to listen to port 1234 and if send the data to 1235.
Following the guidance from Apple, I've implemented a quick multicast group.
Code for starting the group:
let multicast = try! NWMulticastGroup(for: [.hostPort(host: "224.0.0.1", port: 1234)])
group = NWConnectionGroup(with: multicast, using: .udp)
group?.setReceiveHandler(maximumMessageSize: 128) { message, data, b in
log("🧑💻 Received message:")
}
group?.stateUpdateHandler = { (newState) in
print("Group entered state \(String(describing: newState))")
}
group?.start(queue: .global())
Everything works fine when receiving data in iOS from the external device, but the quest is, how I can use the newly created group to send data from iOS to the external device? Especially if its using a different port, other than the one its listening to? Appreciate any help with this.