Posts

Post not yet marked as solved
0 Replies
270 Views
Hey, I was wondering what the best approach would be to receive UDP packets on a specific port and send data to either broadcast or normal addresses from this port. I was able to somewhat achieve this by using a NWListener to receive data and NWConnections to send data (all having .allowLocalEndpointReuse set to true). This seems far too complicated for such an easy task. In addition, the connection used for sending data is not the one receiving the response. So when sending to a specific address, I have to create a new NWConnection, send the data, then the NWListener calls the newConnectionHandler, with a connection where I can receive the response data. This makes the connections quite useless overall, as they only exist for either receiving or sending a single packet. A little bit of background: I'm trying to implement the ArtNet protocol, which uses UDP and port 6454. Depending on whether the packet is meant for node discovery or node-specific data, the packets are either sent to 2.255.255.255 or to a node's unique IP. The discovery response is also sent by each node to the broadcast address on port 6454. Is there a better approach to this using the Network framework or should I use the C socket api? Thomas
Posted Last updated
.