I've to set network name for the broadcast IP address for identify the device from another devices.
This is the code in python that successfully sets network name.
soc = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
soc.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
soc.sendto('connect-to-this-device'.encode(), (172.20.10.10, 1314))
I need same solution in Swift. I am aware of getting local ip address by using this solution. But I don't have any idea How to set broadcast message. I can use Objective-C or C solutions too. Please help me to find out. Thank you!