473,382 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XmlTextReader and NetworkStream

Hi all,

I am writting a Jabber-esque client-server application and have run into an
issue with the XmlTextReader constructor when passing a NetworkStream - It
hangs forever, apparently this is an issue with SP1.

Anyway I have the code below as a work around (using bool keepalives as it
must run on the CF):

while(keepAlive)

{

//do the blocking read on one thread

NetworkStream readStream = new NetworkStream(this.socket, false);

while(!readStream.DataAvailable && keepAlive)

{

Thread.Sleep(100);

}
if(!keepAlive)

break;

MemoryStream memStream = new MemoryStream();

byte[] buffer = new byte[256];

int bytes = 0;

do

{

bytes = readStream.Read(buffer, 0, buffer.Length);

memStream.Write(buffer, 0, bytes);

}while(readStream.DataAvailable);
memStream.Seek(0, SeekOrigin.Begin);

if(DataAvailable != null)

DataAvailable(memStream);

}

My grasp of TCP/IP is still tenuous but I am concerned that a very large
file coming in very slowly could be a problem. Could this code empty the
underlying Socket buffer and return an incomplete stream?

Thanks
Jul 21 '05 #1
0 1651

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: cmjman | last post by:
I have an issue where networkStream.Write doesn't perform its write downstream from my client program until the network stream is closed. I then see the data that was sent appear on the other side....
4
by: 0to60 | last post by:
I have a class that wraps a TcpClient object and manages all the async reading of the socket. It works really nice, and I use it all over the place. But there's this ONE INSTANCE where I create...
1
by: Casey Watson | last post by:
Hi :) I'm having some major trouble with an XML Client/Server application that I am writing. I am using NetworkStream with CryptoStream to Read and Write XML between computers. Now, whenever I...
1
by: Borgbjerg | last post by:
I've got a multi-threaded server (we are very early in the project, trying to uncover some risks), and I want to send data using XML. The class ServerAdapter is supposed to connect to the server...
4
by: Tom Shelton | last post by:
Problem: XmlTextReader Constructor hangs until underlying socket closes when passed a NetworkStream. Example: Dim reader As New XmlTextReader (New NetworkStream(s, False)) I can...
0
by: Stelrad Doulton | last post by:
Hi all, I am writting a Jabber-esque client-server application and have run into an issue with the XmlTextReader constructor when passing a NetworkStream - It hangs forever, apparently this is...
3
by: g66g08d14 | last post by:
Hi. We have a Jabber-esque client server package that uses XMPP for communication over network sockets. Using .NET 2.0, I need to read a full stanza (i.e. balanced xml) as soon as available...
0
by: Al Wilkerson | last post by:
Hey, Has anyone ever got a "Unable to read data from transport connected" message after reading data from a streamreader composed of a networkstream. For example: Server TcpListener...
7
by: littleIO | last post by:
Hi, I'm stuck on a very simple problem and just cant seem to get around it, little help would be much appreciated. I have a server which listens, receives calls, processes them and sends back the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.