I have a program which creates a TcpServerChannel at program start-up:
TcpServerChannel channel = new TcpServerChannel(props, provider);
If the program crashes, e.g. due to an unhandled exception, and I start it again, then the TcpServerChannel constructor throws a SocketException, "Only one usage of each socket address (protocol/network address/port) is normally permitted" (NativeErrorCode
10048). As far as I know, the only way to clear this condition is to restart the machine.
I would like to be able to re-use the port on a subsequent run of the program. With a Socket, I can do this by using
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
Is there any way I can specify socket options when creating a TcpServerChannel? I see that I can specify an exclusiveAddressUse property, but it doesn't seem to help.
View Complete Post