stream

How to read continous HTTP streaming data in Python?

Hi How to read binary streams from a HTTP streamer server in python. I did a search and someone said urllib2 can do the job but had blocking issues. Someone suggested Twisted framework. My questions are: If it's just a streaming client reads data on background, can I ignore the blocking issues caused by urllib2? What will happen if u...

Asynchronous Stream Processing in Python

Let's start with a simple example. A HTTP data stream comes in the following format: MESSAGE_LENGTH, 2 bytes MESSAGE_BODY, REPEAT... Currently, I use urllib2 to retrieve and process streaming data as below: length = response.read(2) while True: data = response.read(length) DO DATA PROCESSING It works, but since all message...

How to play MP3 sound from buffer (ByteArray/Stream) in ActionScript 3?

So.. I have a buffer with MP3 data (If I would save this buffer and call it buffer.mp3 it would play, but in this situation I should not save it to file system). I have to play it, but I can not, what shall I do? I tried the next code to play that buffrer(ByteArray\Stream) (I get MP3 data from server the method of getting data works ...

java: search & replace in a Stream

How do I do on-the-fly search & replace in a Java Stream (input or output)? I don't want to load the stream into memory or to a file. I just see the bytes passing by and I need to do some replacements. The sequences being replaced are short (up to 20 bytes). ...

Writing memory to socket in chunks in C

Hi, I'm attempting to write memory contents to a socket in chunks. I can write files that are smaller than my buffer, but anything else and I'm in deep water. /* allocate memory for file contents */ char fileContents = malloc(sizeof(char)*filesize); /* read a file into memory */ read(fileDescriptor, fileContents , filesize); int chunk...

Type 'System.Web.HttpInputStream' cannot be serialized.

Hi. I have been trying to design a WCF file upload service and am getting the following error in my web application: Type 'System.Web.HttpInputStream' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribut...

Is there any possibility for Interop across a COM/.NET boundary between ADODB.Stream and System.IO.Stream?

I have a COM-Callable Wrapper on a .NET assembly. Some of the methods use streams (System.IO.Stream): either they accept a System.IO.Stream as input, or they return a System.IO.Stream . I'd like to call one of those methods from a COM environment - Classic ASP. Is there any possibility to get interop using ADODB.Stream? In other wo...

C++ standard date/time class

Does C++ stl have a standard time class? Or do I have to convert to c-string before writing to a stream. Example, I want to output the current date/time to a string stream: time_t tm(); ostringstream sout; sout << tm << ends; In this case I get the current date/time written out as a number without any formatting. I can use c- runtime...

How can I upload a file and save it to a Stream for further preview using C# ?

Hi!! Is there a way to upload a file, save it to a Stream, this Stream I will save it temporarily in a Session and, at last, I will try to preview this uploaded file that is in this Session?? For example, a pdf file. Thanks!! EDITED Here's what I'm trying to do: HttpPostedFileBase hpf = Request.Files[0] as HttpPostedFileBase; byte[...

Repeating Ajax Request

Hey! I'm basically trying to get the existing code below to make a new ajax request every time it finishes so there would be a constant stream instead of it just stopping after a batch. <script type="text/javascript"> $(document).ready(function(){ var twitterq = ''; function displayTweet(){ var i = 0; var limit = $("#twitter-results >...

XOR on a very big file

I would like to XOR a very big file (~50 Go). More precisely, I would like to do so by XORing each block of 32 bytes of a plaintext file (because of lack of memory) with the key 3847611839 and create (block after block) a new cipher file. Thank You for any help!! ...

Stream and c++ - parsing file

Hello, I did it before... But I forgot. I have a file with some data: 0.5 0.6 0.7 1.2 1.5 How can I read this in c++? I did it with stream... something like: float var = 0; stream >> var; ...

How to convert link to source to stream in silverlight?

How to convert link to source ( string containing the URL ) to stream in silverlight? ...

Calculate upload transfer speed problem

Hey guys, I have implemented a file transfer rate calculator to display kB/sec for an upload process occuring in my app, however with the following code it seems I am getting 'bursts' in my KB/s readings just after the file commences to upload. This is the portion of my stream code, this streams a file in 1024 chunks to a server using ...

NetworkStream Readable

Hello, I need this property in order to check the availability of my network stream conintuosly. It is described in the Visual Studio 2008 Documentation. But if I check the definiton of NetworkStream class in my Visual Studio there is no "Readable" property within its members. I really need this to update the status of the networkstr...

Lazy stream for C# / .NET

Does anyone know of a lazy stream implementation in .net? IOW, I want a to create a method like this: public Stream MyMethod() { return new LazyStream(...whatever parameters..., delegate() { ... some callback code. }); } and when my other code calls MyMethod() to return retrieve the stream, it will not actually perform...

Is the .NET Stream class poorly designed?

I've spent quite a bit of time getting familiar with the .NET Stream classes. Usually I learn a lot by studying the class design of professional, commercial-grade frameworks, but I have to say that something doesn't quite smell right here. System.IO.Stream is an abstract class representing a sequence of bytes. It has 10 abstract method/...

Different ways of reading and writing files in C#

Hi, I am trying to understand different ways of reading and writing files with their advantages and disadvantages. Like when to use TextWriter/TextReader when File.Create or StreamReader/StreamWriter FileStream etc. When to use what? ...

Stream Read Problem

Suppose we have a code block like this : //Assuming s is a stream: byte[] data = new byte[1000]; s.Read(data,0,data.Length); The read Method could read anywhere from 1 to 1000 bytes, leaving the balance of the stream unread. This is what a C# book says. I don't understand,why Read method would read anywhere from the stream ...

how do you stream a sound clip on a web page so it is not easily downloadable?

This isn't my area of expertise at all, so I was wondering if anyone could point me in the right direction for streaming a sound clip from a web page. The main restriction is that it can't be easily saveable. (So direct .wav's or whatever playing is out.). One suggestion i've had is using some sort of flash streaming. What other option...