Click to See Complete Forum and Search --> : Unregistery Remoting Channel


THY02K
January 15th, 2009, 09:37 PM
hello

having problem trying to unregister remoting channel (.NET 2.0/XP) - error:


System.Net.Sockets.SocketException : Only one usage of each socket address (protocol/network address/port) is normally permitted


On server side, I created the channel by:


TcpChannel oTcpChannel = new TcpChannel(AppContext.DefaultRemotingInterfacePort); ChannelServices.RegisterChannel(oTcpChannel, true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Util.MyRemoteObj, "TcpRemoteObj", WellKnownObjectMode.Singleton);


Then I try to close and restart channel (as part of application re-initialization rountine - this means process never actually exited and that would be undesirable)


ChannelServices.UnregisterChannel(oChannel);
TcpChannel oChTcp = (TcpChannel)oChannel; oChTcp.StopListening(null);


I have no clue how to get around this at the moment - I Googled a bit seems like many people are running into this problem but no solution yet. Many suspected OS (or .NET) failed to release socket on UnregisterChannel until application/process exit. But I don't want to exit the app, just want to reinitialize remoting as part of re-init routine.

Any suggestion? Is there a solution to this problem to this date?

Many thanks!