Suppose I have Multicast group with a group ID and I want to send packet to only one of the group members(as we are doing in anycasting). Is it possible? If yes then how?
By definition all packets sent to a multicast group will be received by all members of the multicast group. The device delivering data to a multicast group does not have to know who the recipients are. The sender sends packets to the multicast ID, and any interested receivers listen to them. In modern networks the router tracks which end nodes are participating in specific multicast groups and only sends multicast traffic to those nodes, there is no need to send mcast traffic to a subnet with no subscribers. The only state being tracked by anything on the network is by the routers as they determine which subnets/endpoints are in/not-in the mcast group.
At the application level it is possible to track which end-nodes are participating in a group, though it does depend on the exact application. When nodes announce that they want to participate in a multicast group that traffic is not delivered to all nodes. However, some app-protocols require an announcement to the mcast group which can be delivered to all nodes, which in turn allows crude tracking of who is in a group. That traffic looks similar to this:
Packets formed like the the reverse:
Are considered malformed, and will be dropped by most TCP/IP stacks.
The only way to deliver content to a specific node via multicast is to have the routers do the necessary packet routing. This may be possible, but it will be for multicast protocols that need it for some reason, if any, and will be baked into the router operating system. This ability will be the decided exception to the rule.
Update: Anycast within Multicast
The communication direction of Multicast is one host sending to all of a group of subscribers.
Anycast is one host sending to a single node which is the nearest of a group.
The two are very nearly opposites in terms of definition and simply can't be merged together.
However, you can approach that model. How far Multicast packets can travel is limited by routers, with internet-edge routers generally not allowing mcast packets past themselves. This limits multicast to inside of a site. In order to connect multiple sites to a single multicast group, nodes inside the site need to get unicast data from some Master server and then relay it to the local multicast group. It would look like this:
The curved dotted lines represent edge routers blocking multicast. The long dash lines are unicast streams to the Local Master servers. The process would go like this:
Think of it like Repeater Stations in Radio. The Repeaters receive their broadcast content out-of-band (satellite downlink, microwave relay, buried wires, whatever) and then broadcast it via their radio antenna. The Local Masters are the Repeaters, the out-of-band link the unicast stream from the Master, and the actual radio broadcast itself is the Multicast to the subscribed clients.
Some networking equipment might be able to provide that information, but I'm unaware of any standard way of doing so. When a node joins a multicast group, no announcement is sent to the source(es).