Quote:
The second iteration doesn't and that port is used. |
There will never be a second iteration, as you set the found variable to
true after the first iteration.
Make sure the found property is set to true after the register-channel
method. Then it will be sure, that it is only set to true, if the
channel could be registered successfully.
try
{
ChannelServices.RegisterChannel(new TcpServerChannel("MyChannel",
startRemotingPort,
formatterProvider), true);
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(HostApplicationRemotingEntryPoint),
"MyObjectUri",
WellKnownObjectMode.Singleton);
found = true;
}
catch (SocketException)
{
startRemotingPort++;
findRemotingPortRetryCount--;
}
hth
Markus