[Mono-list] Remoting: small difference between Mono and .NET

Patrik Reali reali@acm.org
Thu, 22 Jan 2004 09:19:09 +0100


Hi!

I'm posting this to help other programmers falling into this small pitfall.

While testing IIOP.NET (http://iiop-net.sourceforge.net/), we run into a 
difference in the way Mono and .NET handle a IReceiverChannel in the 
remoting (we did define our own channel).

IReceiverChannel defines the method StartListening, which instructs the 
channel to start listening for incoming requests.

A channel is usually deployed as follows:

    IiopChannel chn = new IiopChannel(defaultPort);
    ChannelServices.RegisterChannel(chn);

In .NET, StartListening is not explicitely called, thus we call it in the 
channel's constructor; in Mono, StartListening is called by 
RegisterChannel.

IMHO the Mono way is more intuitive. Anyway, portable code must be able to 
deal with both framework implementations. Thus, we still call 
StartListening in the constructor, and added a check in StartListening to 
make sure it is called only once or after a StopListening.

I hope this small warning may be of some help....

Patrik


------------------------
Patrik Reali
http://www.reali.ch/~patrik/
http://iiop-net.sourceforge.net/