I am figuring out a method to receive UDP packet belonging to a particular port from L2 header using sockets in Linux.

One method is by useing AF_INET/SOCK_RAW method, but i am not sure about how to configure socket call to receive udp stream belonging to one particular port.

another method is using normal UDP socket and use any advanced options to receive packet from L2 header. But will it be possible?

Do i need to use some other method other than sockets to do so?

Any suggestion or pointer is welcomed.