Thanks Rupert. Your help is greatly appreciated! The debug output from the 
interop tests indicate that all is well for the basic pub-sub scenario. 

You are right about the SocketException being thrown after the actual tests. 
The error does not actually affect the messages transfered in any way, it just 
indicates that there are problems in closing a connection. After looking at the 
other unit tests for the client, it seems that the proper way to shutdown is to 
just call Dispose() on the connection. Using this method still produces the 
original exception however. Take BlockingSocketTransport.cs for example, this 
loop is running in a thread near the bottom of the file:

1                    while (_running)
2                    {
3                        Queue frames = _transport.ProtocolChannel.Read();
4
5                        foreach (IDataBlock dataBlock in frames)
6                        {
7                            _transport._protocolListener.OnMessage(dataBlock);
8                        }
9                    }

If _running is set to false in between lines 1 & 3, when the Read() method is 
called, the socket is likely already closed and thus we get an exception. I am 
wondering what the best way to fix this is... 

   - The block inside the loop could become a critical section, thus ensuring 
that the socket is not disconnected during a Read() call. Not sure about the 
side effects here...
   - Perhaps we could simply handle this particular exception better?
   - Or maybe we do nothing :) Well, sort of. Blocking calls (such as Read()) 
on sockets are interruptable by nature so this exception could be thrown at any 
time!

Comments?

Thanks,
Jon


On Wed, Mar 21, 2007 at 01:49:17PM +0000, Rupert Smith wrote:
> The code for these tests was hacked together in a bit of a hurry. It outputs
> information about whether the tests pass or not to log4net, so you have to
> browse the debug level log output to find out if the test passed or not.
> 
> Please add a line to print pass/fail to the console at an appropriate point
> in the TopicPublisher ( around line 143 and 147 where the Debug statements
> are).
> 
> The exception you are seeing occurs after the test has passed when the
> publisher is closing its connection (I think). I don't know if I coded the
> connection close correctly or not. Take a look at the Shutdown method.
> 
> Rupert
> 
> On 3/21/07, Jonathan Anstey <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > I'm trying to use the Java broker with two .NET clients in a pub-sub
> > arrangement. I figured a good starting point for the clients would be in
> > Qpid.Client.Tests.interop. When I start the TopicListener, it connects
> > to the Java broker without issue. When I start the TopicPublisher, it
> > spits out the following exception:
> >
> > 2007-03-21 09:57:53,359 [976] WARN
> > Qpid.Client.Protocol.AMQProtocolListener:OnException(146) - Protocol
> > Listener received exception
> > System.IO.IOException: Unable to read data from the transport
> > connection: A blocking operation was interrupted by a call to
> > WSACancelBlockingCall. ---> System.Net.Sockets.SocketException: A
> > blocking operation was interrupted by a call to WSACancelBlockingCall
> >    at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
> > Int32 size, SocketFlags socketFlags)
> >    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
> > Int32 size)
> >    --- End of inner exception stack trace ---
> >    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
> > Int32 size)
> >    at
> > Qpid.Client.Transport.Socket.Blocking.BlockingSocketProcessor.Read() in
> >
> > E:\dotnet\Qpid.Client\Client\Transport\Socket\Blocking\BlockingSocketProcessor.cs:line
> > 88
> >    at Qpid.Client.Transport.Socket.Blocking.ByteChannel.Read() in
> > E:\dotnet\Qpid.Client\Client\Transport\Socket\Blocking\ByteChannel.cs:line
> > 41
> >    at Qpid.Client.Transport.AmqpChannel.Read() in
> > E:\dotnet\Qpid.Client\Client\Transport\AmqpChannel.cs:line 52
> >    at
> >
> > Qpid.Client.Transport.Socket.Blocking.BlockingSocketTransport.ReaderRunner.Run
> > ()
> > in
> >
> > E:\dotnet\Qpid.Client\Client\Transport\Socket\Blocking\BlockingSocketTransport.cs:line
> > 98
> >
> > Can anyone shed any light on this? Also, are there anymore known interop
> > issues with the .NET client and Java broker?
> >
> > Thanks!
> > Jon
> >

Reply via email to