Limit links from a port and to a port

How do I limit the number of links from a port and to a port for a GoSimpleNode object?

Take a look at the LimitedNodePort class in the LimitedNode.cs/.vb file of the Demo1 sample.
Basically you need to override GoPort.CanLinkFrom and .CanLinkTo, to check the LinksCount property. You can override GoSimpleNode.CreatePort to return an instance of your class, rather than the standard behavior as documented in the API reference.