﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Bohdan,
It works in .NET, but not in SL.
Therefor, it is SL fault.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment22</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment22</guid><pubDate>Wed, 22 Aug 2012 10:56:39 GMT</pubDate></item><item><title>Bohdan Trotsenko commented on Silverlight streaming - the race condition is already included</title><description>That's not faulty Silverlight.

Windows sends tcp data in segments. (And the default waiting delay is 400ms). 

Flush() doesn't affect NetworkStream().

There's trickery for working around that.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment21</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment21</guid><pubDate>Wed, 22 Aug 2012 10:52:25 GMT</pubDate></item><item><title>Guillaume commented on Silverlight streaming - the race condition is already included</title><description>Really weird bug, if you keep the first test and the last one, everything is displayed in silverlight+ chrome ( in a VM if that matter).</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment20</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment20</guid><pubDate>Sun, 29 Jul 2012 06:48:05 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Ken,
If that was what it was, I would see the same behavior in .NET and SL, but I am seeing different behavior between the two.
HttpListener doesn't need to flush, it writes out immediately.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment19</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment19</guid><pubDate>Thu, 26 Jul 2012 21:01:38 GMT</pubDate></item><item><title>Ken Egozi commented on Silverlight streaming - the race condition is already included</title><description>An interesting thing I noticed: the call to Flush did not actually flush the stream - no network activity was noticed. I remember reading somewhere that http response stream in HttpListener are not flushing when told to.
the rest of the bytes are send after the ReadLine, when the writer closes (and closes the outgoing request stream) forcing an actual flush.

I tried with a comparable nodejs server script. The flush behavior there is such that to get proper progressive flushing, you need to write something, wait a little bit, and from then on it will flush every now and then (depending on its internal implementation). When I did that I started seeing the bytes actually being streamed in chunks over the wire to the client and getting there correctly.
</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment18</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment18</guid><pubDate>Thu, 26 Jul 2012 20:59:57 GMT</pubDate></item><item><title>grega_g commented on Silverlight streaming - the race condition is already included</title><description>Nop, couldn't reproduce. Whenever request is made to "/" I get string back to silverlight and displayed in txtbox</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment17</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment17</guid><pubDate>Thu, 26 Jul 2012 05:54:17 GMT</pubDate></item><item><title>Torvin commented on Silverlight streaming - the race condition is already included</title><description>Ken, it's TCP! Packets don't get dropped in TCP.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment16</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment16</guid><pubDate>Thu, 26 Jul 2012 05:48:19 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Ken,
We aren't disposing the server, we kep it around in the repro.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment15</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment15</guid><pubDate>Thu, 26 Jul 2012 03:37:28 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Ken,
What do you mean, takes too log?
We immediately call it again</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment14</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment14</guid><pubDate>Thu, 26 Jul 2012 03:37:06 GMT</pubDate></item><item><title>Ken Egozi commented on Silverlight streaming - the race condition is already included</title><description>btw - the server dispose of the writer which probably dispose of the ctx.Response.OutputStream as well so the client is not getting any more data on the stream</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment13</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment13</guid><pubDate>Wed, 25 Jul 2012 22:57:41 GMT</pubDate></item><item><title>Ken Egozi commented on Silverlight streaming - the race condition is already included</title><description>I'm not really familiar with Silverlight's web requests mechanisms, but this code looks wrong to me.

it takes *way* too long for you to set up the client request to listen to the next incoming bytes, so they get dropped between the beginning of the handler to when you call read async again.
did you try calling ReadAsync first? (after shortcircuiting the EOF signal)</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment12</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment12</guid><pubDate>Wed, 25 Jul 2012 21:33:17 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Grega_g,
So, you reproduced the issue without this?</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment11</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment11</guid><pubDate>Wed, 25 Jul 2012 15:52:04 GMT</pubDate></item><item><title>grega_g commented on Silverlight streaming - the race condition is already included</title><description>Sad to say it took me some time to figure that out...</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment10</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment10</guid><pubDate>Wed, 25 Jul 2012 14:07:34 GMT</pubDate></item><item><title>grega_g commented on Silverlight streaming - the race condition is already included</title><description>In firefox request for "/" only executes once, after that is from cache. After FF is restarted than request is made for "/" again.

Looks like this:http://tinypic.com/r/5pd88/6</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment9</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment9</guid><pubDate>Wed, 25 Jul 2012 14:03:13 GMT</pubDate></item><item><title>grega_g commented on Silverlight streaming - the race condition is already included</title><description>It works even without Flush() calls.

</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment8</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment8</guid><pubDate>Wed, 25 Jul 2012 13:56:05 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Grega_g,
It might be a timing issue, depending on how fast you get the data.
What happens when you use just one flush?</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment7</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment7</guid><pubDate>Wed, 25 Jul 2012 13:09:58 GMT</pubDate></item><item><title>grega_g commented on Silverlight streaming - the race condition is already included</title><description>works as well</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment6</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment6</guid><pubDate>Wed, 25 Jul 2012 13:06:28 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Grega_g,
Try in IE or Chrome, those are the things I tested this with</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment5</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment5</guid><pubDate>Wed, 25 Jul 2012 13:03:25 GMT</pubDate></item><item><title>grega_g commented on Silverlight streaming - the race condition is already included</title><description>                    // Doesn't work
                    writer.WriteLine("first");
                    writer.Flush();
                    writer.WriteLine("second");
                    writer.Flush();

works for me:
I get "first\nsecond" in my silverlight (firefox)</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment4</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment4</guid><pubDate>Wed, 25 Jul 2012 13:00:29 GMT</pubDate></item><item><title>Andomar commented on Silverlight streaming - the race condition is already included</title><description>Ok, only other thing I can think of is that you could check with Wireshark if the server or client is at fault.

Good luck!</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment3</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment3</guid><pubDate>Wed, 25 Jul 2012 11:26:28 GMT</pubDate></item><item><title>Ayende Rahien commented on Silverlight streaming - the race condition is already included</title><description>Andomar,
No, the application is still there and waiting.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment2</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment2</guid><pubDate>Wed, 25 Jul 2012 10:27:28 GMT</pubDate></item><item><title>Andomar commented on Silverlight streaming - the race condition is already included</title><description>Just a question, does the application that sends the lines quit (end its proces) right after it sends the data?

Since the TCP stack is just a library, you can loose data if you ExitProcess right after sending something.</description><link>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment1</link><guid>http://ayende.com/157377/silverlight-streaming-the-race-condition-is-already-included#comment1</guid><pubDate>Wed, 25 Jul 2012 10:24:48 GMT</pubDate></item></channel></rss>