Clearing ports after RemotingConfiguration.Configure

  • Thread starter Thread starter Mantorok
  • Start date Start date
M

Mantorok

Hi

I use RemotingCOnfiguration.Configure("App.config") to configure my ports,
however sometimes after I have closed the app and restart it throws an
exception "Only one usage of each socket address (protocol/network
address/port) is normally permitted".

Is there a way of closing ports after an app has finished runnning?

Thanks
Kev
 
Hi...

Port/sockers are unmanaged resources and, as such, require some explicit
cleanup.
Close the communication channel and Dispose() of it.

John Puopolo
 
You can find out which channels are in use
System.Runtime.Remoting.Channels.ChannelServices.RegisteredChannels()
That returns an array of IChannels. You can use UnregisterChannel in the
same namespace to deallocate the channel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top