Home All Groups Group Topic Archive Search About

.Net Remoting Exception

Author
31 May 2006 9:29 PM
Brian
I am getting an exception in the following situation:

Start .Net Remoting Server
Start .Net Remoting Client
Client Request - Works
Client Request - Works
Client Request - Works
....
Close .Net Remoting Client
Start .Net Remoting Client
Client Request - *Exception*
Client Request - Works
Client Request - Works
....
Close .Net Remoting Client
Start .Net Remoting Client
Client Request - *Exception*
Client Request - Works
....


Hopefully you get the idea.  The first request after closing the
application fails.

The exception is:  System.Net.Sockets.SocketException:  A non-blocking
socket operation could not be completed immediately.

Here is the basic code from the Remoting Client:

{{{
             TcpClientChannel channel = null;
             try
             {
                 channel = new TcpClientChannel();
                 ChannelServices.RegisterChannel(channel, false);
                 IMyService svc =
(IMyService)Activator.GetObject(typeof(IMyService),
                     "tcp://172.1.1.1:9988/MyService");

                 MyObject o = svc.GetObject();

                 System.Windows.Forms.MessageBox.Show("o.Property:  " +
o.Property);
             }
             catch (Exception ex)
             {
                 log.Error("Exception:", ex);
                 System.Windows.Forms.MessageBox.Show("Exception:  " +
ex.Message);
             }
             finally
             {
                 ChannelServices.UnregisterChannel(channel);

             }
}}}

AddThis Social Bookmark Button