Main Site Documentation

Problem with XmlReader


#1

Hi!

I have troubles with XmlTextReader and a NetworkStream…

I create a socket, bind a endpoint on it, do a listen and a accept - everything works fine!

Then I do the following:


NetworkStream nwstream = new NetworkStream(socket_, true);
XmlReader xmlReader = XmlReader.Create(nwstream);

–> the XmlReader blocks (I also tried XmlTextReader). What can I do, that the XmlReader does not block?

Thanks!


#2

Have you compared it to the emulator?


#3

I compared it to the example of the Emulator in the Book “.NET Micro Framework for Experts” - its the same.

I just tried another debugging - the XmlReader element blocks until the timeout raises - but why? :slight_smile:

Thanks…

EDIT: Could it be the same problem as this: http://support.microsoft.com/kb/885456/en-us ?
If yes, what can I do to get it solved…


#4

That link is not related. Try to make a simple app that you run on device and in emulator. You can also try to get your data into a buffer that you parse later. Assuming there is a problem, we need to know where and how to repro.


#5

OK, I tried a minimalistic example…

The Code:
http://pastebin.com/GhaciEs8

And my Java Example code on the pc:
http://pastebin.com/uiJDaqxQ

The debug output of the ChipworkX-Device (I don’t know how to use the Emulator) - and it’s in German:

Der Thread '<Kein Name>' (0x2) hat mit Code 0 (0x0) geendet.
Waiting for connection...
Got socket connection from: 192.168.1.105:49499

Thanks for any help…

EDIT: OK, the creation of the thread makes some troubles! I can send data to the pc, thats no problem with the NetworkStream. But I have troubles to read data from the NetworkStream. I cannot read any data from there - read always blocks or I get an exception “ResourceTemporarilyUnavailable”

So I just tried to send something (works!) and try to receive some text from java - that does NOT work.

Code:
http://pastebin.com/H8YsjnkV


#6

When you deploy to the device, you usually select USB. There is another option fro emulator. That is all you have to do. I am curious of the emulator gives you different results.

Note that the emulator can’t run any GHI libraries but you do not need those in a simple network test.


#7

Ok, I tried that.

I get an exception at:

NI_.EnableStaticIP("192.168.1.201", "255.255.255.0", "192.168.1.1");

Exception:

Exception System.Exception - CLR_E_FAIL (1)

#### Message: 
#### Microsoft.SPOT.Net.NetworkInformation.NetworkInterface::UpdateConfiguration [IP: 0000] ####
#### Microsoft.SPOT.Net.NetworkInformation.NetworkInterface::EnableStaticIP [IP: 0028] ####
#### test.Program::Main [IP: 0018] ####