stream

getting Stream in and out of VarBinary(MAX) column? (SQL Server)

I have some data that I am serializing. I need to save and restore this from a VarBinary column using ADO.NET (also using Enterprise Library) under .Net 3.5 (not 4.0 yet). The only interface I seem to be able to find and get working is by using a byte[]. This requires allocating a large array to do the transfer. It seems impossible t...

Problem with Byte Flood Cryptography (C library)

I have a little problem with a C library: Byte Flood Cryptography. ( http://bfcrypt.sourceforge.net ). I would create a program which use both linux sockets and Byte Flood Cryptography (the Byte Flood Cryptography functions are near from those provided from stdio.h, and this, I have understand). I don't know how to 'bind' the two s...

computeHash byte[] and Stream difference

Hi All, I've been having some trouble with computeHash. I'm using both computeHash(Stream) and computeHash(byte[]). For some reason, they are giving back different result. I've tried writing the byte[] into a MemStream but result was the same when using Byte[] FileStream zz = new FileStream(t.Filename, FileMode.Open, FileAccess.Read);...

Compute a hash from a stream of unknown length in C#

What is the best solution in C# for computing an "on the fly" md5 like hash of a stream of unknown length? Specifically, I want to compute a hash from data received over the network. I know I am done receiving data when the sender terminates the connection, so I don't know the length in advance. [EDIT] - Right now I am using md5, but th...

Streaming data for state machine playback

Hey all, I have a state machine design that needs to support playback. We have states that perform actions and sometimes need to generate random numbers. In case the program shuts down while in the middle of the FSM's execution, the program needs to playback the whole FSM using the same random numbers as before. For a basic example, le...

C# ftp download and stream to XML error

I'm trying to get an .xml file that's somewhere on a server loaded into a streamerader to stream it to XML and process it. This is what i get: EndOfStream = 'reader.EndOfStream' threw an exception of type 'System.ObjectDisposedException' I do see that im logged in on the server etc: StatusDescription = "226 Transfer complete.\r\n" It ...

Facebook Graph Api - Posting to Fan Page as an Admin

Hello, I've setup a script which allows users to post messages to a fan page on Facebook. It all works but there's one small issue. The Problem: When the post is added to the page feed it displays the posting user's personal account. I would prefer it to show the account of the page (like when you're admin of the page it says it came ...

Getting a Stream from an absolute path?

Hi Guys, I have this method: public RasImage Load(Stream stream); if I want to load a url like: string _url = "http://localhost/Application1/Images/Icons/hand.jpg"; How can I make this url in to a stream and pass it into my load method? ...

PhP ftp put error message: failed to open stream

Hi, Need help. Am trying to upload an image from my local machine (PC) to the FTP server. In return, received the following error: Warning: ftp_put(c:/dhimage/DSC_0067.JPG) [function.ftp-put]: failed to open stream: No such file or directory in /home/dxxx/public_html/ftp/test.php on line 37 Cannot upload Here's my code: // get FTP a...

Redirect streams for prompting passwords

Hi, I have a script that prompt for a password to achieve a specific task. I wanna skip entering password each time. for this, i thought about sth like that: ./myscript < my_file_containing_pass but unfortunatly, this doesn't work. any idea? ...

How can I stream a .net chart as a PNG? (Parameter is not valid)

I have a generic handler in vb.net that builds a chart and then returns a png as a result. Relevant code on /GetChart.ashx (which is actually called as /GetChart.ashx?report=1): AssetChart.RenderType = RenderType.BinaryStreaming Dim mstream As New MemoryStream() AssetChart.SaveImage(mstream, ChartImageFormat.Png) Dim byteArray As Byte...

Problems decrypting HTTP Live Stream

I have a single key encrypted HTTP Live Stream which decodes fine in Quicktime and iPhone. I'm trying to create a simple client application to do the decryption of the ts files. Right now I've used openssl to decrypt. I believe I have the correct arguments to openssl and I'm inserting the key and the IV properly. I can successfully d...

CryptoStream.Close() fails when the disk is full

I am using a CryptoStream for writing encrypted audio data to the file (underlying stream is FileStream). When I try to call CryptoStream.Close() over the full disk, I get an exception. I know that this is because CryptoStream.Close() invokes FlushFinalBlock() during disposing. As a result I get the corrupted data in my encrypted file an...

iPhone: Catching a Connection Error With NSStream

I have written a program that connects to a server on a given IP using the NSStream protocol outlined in Apple's stream programming guide. The connection and transfer of data works flawlessly, however if the user specifies the wrong IP and the program attempts to open the streams it results in the program becoming unresponsive. From wha...

Save stream to the file

Hello. How can I write Byte [] buf to the file without turning it into string ? public Int32 OnWriteData(Byte[] buf, Int32 size, Int32 nmemb, Object extraData) { SockBuff = SockBuff + System.Text.Encoding.UTF8.GetString(buf); return size * nmemb; } Been trying to find something working for hours now. ...

[SOLVED] C#, WPF, streaming source of an image not working.

I am using the following code to stream an image source: BitmapImage Art3 = new BitmapImage(); using (FileStream stream = File.OpenRead("c:\\temp\\Album.jpg")) { Art3.BeginInit(); Art3.StreamSource = stream; Art3.EndInit(); } artwork.Source = Art3; "artwork" i...

Treating 7z files as .NET streams

I would like to chain multiple stream operations (like downloading a file, uncompressing it on the fly, and processing the data without any temp files). The files are in 7z format. There is a LZMA SDK available, but forces me to create an outside output stream instead of being a stream itself - in other words the output stream will have ...

Implementing async stream for producer/cosumer in C# / .NET

There is a lib that outputs its results into a given Stream object. I would like to begin consuming the results before the lib is done. The Stream should be blocking to simplify usage and avoid excessive memory consumption if producer runs ahead too far; thread safe to allow independent existence of producer and consumer. Once the lib f...

OneTimePad implementation fails. Maybe a stream problem?

Hi, I had some time and decided to implement a one time pad just for fun and self education. Now I end up with a weird behavior of the data. Its driving me crazy ^^. Would you please help me? Thanks in advance. There is an encrypt method which takes as arguements: an InputStream for the plain text an OutputStreams for the cipher tex...

Read file problem

Hello, I can't find a solution for this problem: I write a program, which reads all file in a directory and puts them in a listbox. When a user select a file from a listbox, the program reads the selected file and prints out some info... The problem is that after the firs selection my program "stop working". He don't crash, but when I...