Tags and socket names are two distinct features that perform different tasks. Tags are added to objects for users to quickly determine if two different objects should be handled in the same way. There are methods to return tags associated with any object.
Sockets are internal structures to a single mesh and are used to give location and orientation data to a single object. Typically these are known ahead of time or arrays of the names are stored within a class to be accessed dynamically during runtime. You can retrieve the socket names through methods specific to sockets.
May I ask what it is you’re trying to achieve?