在 WCF 中,当您创建 ChannelFactory 时,您可以指定您的端点(或您希望连接的 IP 地址)。
Dim factory As ChannelFactory(Of IChatServiceChannel)
factory = New DuplexChannelFactory(Of IChatServiceChannel)(callbackObject, binding, endpoint)
Dim Channel = factory.CreateChannel()
Run Code Online (Sandbox Code Playgroud)
您可以通过指定不同的端点来连接到任意多个不同的 IP。