Hi Luis,
in the Connecting event you can easily get the ports being connected:
NPort port1 = (NPort)document.GetElementFromUniqueId(args.UniqueId1);
NPort port2 = (NPort)document.GetElementFromUniqueId(args.UniqueId2);
Next you can use the Shape property of the port to get the shape.