dataset.ReadXml does not return until writer closes stream

  • Thread starter Thread starter Craig Traxler
  • Start date Start date
C

Craig Traxler

What causes ReadXml to return? I have a java application that is writing an
xml stream to a socket. I am using VB .Net to read the stream into a
dataset. The problem is that the call to ReadXml does not return until the
writer closes the socket. Just flushing the buffer is not sufficient. I
put breakpoints in both applications and the stream returns DataAvailable as
True in VB when the writer flushes the buffer but ReadXml continues to wait
for something. If the writer closes the connection ReadXml processes the
stream fine and I am able to work with the dataset. Any insights anyone?
 
As far as I'm aware, flushing the buffer forces any data waiting to be
sent - but doesn't necessarily say that there won't be any more data
arriving later - which is why ReadXml is still hanging in there waiting
for the possibility of more data.

what's the problem with closing the socket when you've finished with it?
If you want to use it to send something else, then you'd probably have
to generate another stream, which is closed when you've finished with
the first bit of the data - and pass the ReadXml method this stream.
You'd then be free to continue doing other stuff on the original socket
stream.
 
Craig,

Looks like closing the socket is the only reason for the SocketStream class
to indicate the caller that the end of stream has been reached.
 
Thanks for the response. I do not know the expense of opening and closing
sockets and was trying to be conservative. I can go down this route if I
have to.
 
Thanks for the response. Can you point me to good reference materials on
this?

Regards,


Craig Traxler

Dmitriy Lapshin said:
Craig,

Looks like closing the socket is the only reason for the SocketStream class
to indicate the caller that the end of stream has been reached.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Craig Traxler said:
What causes ReadXml to return? I have a java application that is
writing
an
xml stream to a socket. I am using VB .Net to read the stream into a
dataset. The problem is that the call to ReadXml does not return until the
writer closes the socket. Just flushing the buffer is not sufficient. I
put breakpoints in both applications and the stream returns
DataAvailable
as
True in VB when the writer flushes the buffer but ReadXml continues to wait
for something. If the writer closes the connection ReadXml processes the
stream fine and I am able to work with the dataset. Any insights anyone?
 
Back
Top