How do you attach a socket on one object to a socket on another object

I have a weapon that has a socket called ‘Grip’ and I’m attaching it to a hand with a socket called ‘Hand’. The origin of the gun isn’t where the grip/handle of the gun is. And the gun attaches o the hand in the middle of the gun. I can probably offset everything with SetLocalLocation but I was wondering if there was an elegant way to support multiple objects all having the same socket name. Preferably in c++.

In very new to Unreal Engine and am still trying to get the basics down.