Get the node from a specific connected socket

I’d like to get the node connected the a given socket number.
Is that possible?

Sure, that is called the from_node and is a property of the socket itself.

Here is a brief way to find the from_node by scanning the inputs of another node.

for inp in passedNode.inputs:
        if inp.is_linked:
                from_socket = inp.links[0].from_socket
                from_socket = None
            if from_socket != None:
                from_node = from_socket.node
                if from_node != None:
                    # Now you have the from node you can process.

Thank you!!