I am trying to find a solution to read the packet destination for an internet connection through wifi. I am able to do the same for a lan connection using packet sniffer example. But the same is not working for wifi connection.

mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);

The above code is used for LAN . what is to be done for Wifi Packet Sniffer