'Receive UDP packets over Android LocalOnlyHotspot

I am creating an specific application where a central android device serve as a hotspot for other devices. The Central device enables the LocalOnlyHotspot and shares the SSID and password for other devices to connect(Manually scan a QR code generated). Once connected these devices will broadcast some information which the central device need to capture and use later.

Is there a way for the central device to read a specific port on the shared hotspot?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source