remoting problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,
I have developed a simple dotnet remoting application.
My server is in a dll and a host application activates the server by
using following code:

HttpChannel chnl = new HttpChannel(1234);
ChannelServices.RegisterChannel(chnl);
RemotingConfiguration.RegisterWellKnownServiceType( typeof( Server ),
"Server.soap",
WellKnownObjectMode.Singleton
);

and when i am done with the work i just unregister the channel.

ChannelServices.UnregisterChannel(chnl);

but again when i activate the server object with the above code i get
the following error:

"Only one usage of each socket address(protocol/network
address/port)is normally permitted."

whether i am doing any mistake while unregistering a channel?
or not doing proper clean up?

any help is most welcome.

thanks in advance.

regards,

kiran gadekar
 
kiran gadekar said:
Hi All,
I have developed a simple dotnet remoting application.
My server is in a dll and a host application activates the server by
using following code:

HttpChannel chnl = new HttpChannel(1234);
ChannelServices.RegisterChannel(chnl);
RemotingConfiguration.RegisterWellKnownServiceType( typeof( Server ),
"Server.soap",
WellKnownObjectMode.Singleton
);

and when i am done with the work i just unregister the channel.

ChannelServices.UnregisterChannel(chnl);

but again when i activate the server object with the above code i get
the following error:

"Only one usage of each socket address(protocol/network
address/port)is normally permitted."

whether i am doing any mistake while unregistering a channel?
or not doing proper clean up?

When do you call the UnregisterChannel? And what happens if you don't call
it?
 
Hi,

there is a time delay for the system to release the port. It is about 2
minutes. After that the port is free and you can reuse it.
But, why do you need to unregister the channel. You may not use
RegisterWllKnownService, but use RemotingServices.Marshal to expose your
singleton. And when you want to stop the access to it, you can invoke
Disconnect on the object.

Hope that helps
Sunny
 
Hi Kiran,

There's really no need to unregister the channel. Register the channel once
and leave it for the entire run of the app.
I don't know why unregistering is not working for you, but the workaround is
"not to do it."

HTH,
--- Nick
 
Back
Top