Questions tagged [binaryreader]

In .net is a class used to read binary values. In general, it is a class or a program to read and manipulate binary data.

244 questions
3
votes
1 answer

BinaryReader.Read does not throw IOException when the connection is lost

I use HttpWebResponse.BeginGetResponse() method to make a request to my server. The request has AllowReadStreamBuffering set to false so that the data will not be buffered. In the "Request Complete" notification I do the following (no error handling…
Mihai
  • 89
  • 6
3
votes
2 answers

Can't read data correctly with BinaryReader from WebRequest

Hy! I'm developing a C# SOAP service to communicate with one of our governmental services. They also use SOAP for communication, but now they introduced two new endpoints that handle requests very differenty. The first thing that I noticed is that…
Balázs Varga
  • 1,797
  • 2
  • 16
  • 32
3
votes
2 answers

Error in conversion from binary value to double in c#

I'm trying to read a binary file made from a c++ program. This file has some double numbers and, when I tried to read them, I get a wrong double value. This is the HEX value read from the file: 00-67-CC-02-B3-F7-40-CA Expected value:…
Tode93
  • 33
  • 3
3
votes
1 answer

Manipulating an Adaptive IInputStream (MPEG-DASH) on the fly

This is the first time I am asking a question here and I couldn't find anything in the search function. The Problem: I am receiving (via HttpClient) an IInputStream (MP4 Segments). The Problem is, that my MediaPlayer doesn't play it, because this…
3
votes
1 answer

Read binary file from a zip file from C# without unzipping it

I would like to read a binary file from a zip file without unzipping it . The zip file structure: zipFolderName/subFolder/BinFile In the BinFile, I have: Id1, id2, value1 // id1, id2 are string, value1 is int In C#: ZipEntry binFileName = …; //…
user3448011
  • 1,469
  • 1
  • 17
  • 39
3
votes
3 answers

What does the FillBuffer method of BinaryReader do?

According to the documentation: Fills the internal buffer with the specified number of bytes read from the stream. What does this mean (what's the internal buffer?)?
Alofons
  • 33
  • 3
3
votes
4 answers

I have written the exact code in vb and C# and it doesnt work the same... logic is identical... i hope

Kind of new to C# and trying to broaden my abilities a bit. I have this code in VB: Private Sub BreakdownFilesToCompare(ByRef file1BReader As BinaryReader, _ ByRef file2BReader As BinaryReader, _ …
Sean P
  • 949
  • 4
  • 22
  • 41
3
votes
1 answer

How do I avoid timeout when using BinaryReader and BinaryWriter on the same CryptoStream?

I have a program that uses BinaryReader and BinaryWriter to send string, int and byte[] messages over the network. The order and content of the messages is significant for the flow of the execution on both server and client, but the duration is…
Steinbitglis
  • 2,482
  • 2
  • 27
  • 40
3
votes
3 answers

How to properly read 16 byte unsigned integer with BinaryReader

I need to parse a binary stream in .NET to convert a 16 byte unsigned integer. I would like to use the BinaryReader.ReadUIntXX() functions but there isn't a BinaryReader.ReadUInt128() function available. I assume I will have to roll my own…
Brent
  • 101
  • 1
  • 2
  • 9
3
votes
1 answer

EndOfStreamException with simple BinaryWriter and BinaryReader

I'm using the following code: var fileStream = new MemoryStream(); var binaryWriter = new BinaryWriter(fileStream); var binaryReader = new BinaryReader(fileStream); binaryWriter.Write("Hello"); var msg = binaryReader.ReadString(); However I'm…
Mugen
  • 8,301
  • 10
  • 62
  • 140
3
votes
1 answer

ReadInt32 vs. ReadUInt32

I was tinkering with IP packet 'parsers' when I noticed something odd. When it came to parsing the IP addresses, in C# private uint srcAddress; // stuff srcAddress = (uint)(binaryReader.ReadInt32()); does the trick, so you'd think this VB.Net…
esjr
  • 186
  • 3
  • 9
3
votes
1 answer

Method difference between languages (Python->C#)

I am trying to reproduce a sequence of code from a Python program in C#. In Python I have: element1, element2 = struct.unpack('!hh', data[2:6]) The above statement unpacks from a "substring" of data in short-short (network byte order) format. The…
Gabe
  • 961
  • 1
  • 10
  • 23
3
votes
1 answer

What does BE or LE mean in Buffer functions?

I have a PHP class for reading Binary data that I'm converting to NodeJS or finding the equivalent of a couple functions in NodeJS. The functions I'm interested in this BinaryReader class are ReadULong and ReadUShort. I believe these mean read…
Logan
  • 10,649
  • 13
  • 41
  • 54
3
votes
1 answer

loop for reading different data types & sizes off very large byte array from file

I have a raw byte stream stored on a file (rawbytes.txt) that I need to parse and output to a CSV-style text file. The input of raw bytes (when read as characters/long/int etc.) looks something like…
John
  • 179
  • 2
  • 10
3
votes
2 answers

C# BinaryReader "stream does not support seek operations"

I am trying to download files from an ftp server using C# and ftpwebrequest. I can get the bytes using BinaryReader, but when I try to read the stream using br.ReadBytes(int), I get an error that BinaryReader does not support seek operations. Does…
Captain Obvious
  • 757
  • 1
  • 9
  • 12
1 2
3
16 17