Questions tagged [buffer]

A buffer is an area of memory set aside for temporary storage of data while it is being moved from one place to another. This is typically done to speed up processes with significant latency, such as writing to a disk, printer or other physical device. The output is ready to be sent to the device before the device is ready to accept it, so it is moved to the buffer so that the sending program does not have to continue waiting.

A may be used when moving data between processes within a computer. This is comparable to buffers in telecommunication. Buffers can be implemented in a fixed memory location in hardware—or by using a virtual data buffer in software, pointing at a location in the physical memory. In all cases, the data stored in a data buffer are stored on a physical storage medium. A majority of buffers are implemented in software, which typically use the faster RAM to store temporary data, due to the much faster access time compared with hard disk drives. Buffers are typically used when there is a difference between the rate at which data is received and the rate at which it can be processed, or in the case that these rates are variable, for example in a printer spooler or in online video streaming.


References

7035 questions
13
votes
1 answer

byte size of buffer (Javascript / Node)

How do I get the size (in bytes) of a bufferd image in javascript? I am not allowed to trust the file size in the client side, and need to verify in the backend as part of upload validation. My setup is as follows: 1- I upload a file in the client…
jaimefps
  • 2,244
  • 8
  • 22
  • 45
13
votes
8 answers

PHP Flush/ob_flush not working

I've tried several attempts at getting my flush and ob_flush to work. I've tried setting the ini to allow buffering, I've tried using several different functions I found online for output buffering, and none of it at all is working. The script wants…
JakeSmith
  • 131
  • 1
  • 1
  • 3
13
votes
1 answer

Python: named in-memory file with actual disk-file semantics?

I know I can use io.StringIO or io.BytesIO to return an open file handle that can be written to and read from. However, I'm looking for a way to make an in-memory region look like a named disk file that has not yet been opened. The reason I want…
HippoMan
  • 2,119
  • 2
  • 25
  • 48
13
votes
1 answer

Choosing a buffer size for a WebSocket response

I'm writing a C# application that connects to a websocket server, and receives a JSON response of unknown size. I'm using the ClientWebSocket class for this purpose. The only way to receive data from the client seems to be with the ReceiveAsync…
Migwell
  • 18,631
  • 21
  • 91
  • 160
13
votes
5 answers

How to make a simple C++ program in which std::cout is not flushed

In an effort to better understand buffered streams in C++, I would like to write a simple program in which the std::cout buffer is NOT flushed before termination. Since I have read that std::cout is flushed on normal termination, I tried throwing a…
ivme
  • 548
  • 5
  • 14
13
votes
5 answers

Fully buffer video in Chrome

Is it possible to fully buffer HTML5 video in Chrome (and Opera)? I host the movie in .mp4 and .webm on amazon S3. In HTML I use standard
Michal
  • 733
  • 2
  • 6
  • 23
13
votes
2 answers

Which methods implement the buffer interface in Python?

I have a custom class with a serialize method, and I want to be able to write this class directly to files and have the return value of the serialize method get written, in Python 2.6. (I'm not trying to pickle my objects, this is something totally…
Eli Courtwright
  • 186,300
  • 67
  • 213
  • 256
13
votes
1 answer

Pushing binary data to Amazon S3 using Node.js

I'm trying to take an image and upload it to an Amazon S3 bucket using Node.js. In the end, I want to be able to push the image up to S3, and then be able to access that S3 URL and see the image in a browser. I'm using a Curl query to do an HTTP…
Jack
  • 5,264
  • 7
  • 34
  • 43
13
votes
3 answers

Python writing binary files, bytes

Python 3. I'm using QT's file dialog widget to save PDFs downloaded from the internet. I've been reading the file using 'open', and attempting to write it using the file dialog widget. However, I've been running into a"TypeError:…
Turtles Are Cute
  • 3,200
  • 6
  • 30
  • 38
13
votes
2 answers

Linux UDP max size of receive buffer

What's the maximum size of Linux UDP receive buffer? I thought it's limited only by available RAM, but when I set 5GB for rmem_max: echo 5000000000 > /proc/sys/net/core/rmem_max and 4GB for the actual socket buffer (in Erlang): gen_udp:listen(Port,…
Wacław Borowiec
  • 700
  • 1
  • 6
  • 12
13
votes
2 answers

C# Copy variables into buffer without creating garbage?

Is it possible in C# .Net (3.5 and above) to copy a variable into a byte[] buffer without creating any garbage in the process? For instance: int variableToCopy = 9861; byte[] buffer = new byte[1024]; byte[] bytes =…
markmnl
  • 11,116
  • 8
  • 73
  • 109
13
votes
7 answers

nodejs write 64bit unsigned integer to buffer

I want to store a 64bit (8 byte) big integer to a nodejs buffer object in big endian format. The problem about this task is that nodejs buffer only supports writing 32bit integers as maximum (with buf.write32UInt32BE(value, offset)). So I thought,…
bodokaiser
  • 15,122
  • 22
  • 97
  • 140
13
votes
2 answers

Bypassing buffering of subprocess output with popen in C or Python

I have a general question about popen (and all related functions), applicable to all operating systems, when I write a python script or some c code and run the resulting executable from the console (win or linux), i can immediately see the output…
Gearoid Murphy
  • 11,834
  • 17
  • 68
  • 86
13
votes
3 answers

Too many split screens opening in Emacs!

Ever since I installed emacs on a new machine I have seen an ugly behaviour. Unfortunately, my old .emacs files are rather fragmented and I can't determine whether I used to have elisp that took care of this. The problem is this: it used to be that…
user168811
  • 133
  • 1
  • 4
13
votes
1 answer

Buffered and Unbuffered Streams in Java

I was going through some of the documentation on Java IO and just wanted to make sure whether I get this right: Unbuffered Input Streams: FileInputStream, InputStreamReader, FileReader Unbuffered Output Streams: FileOutputStream, OutputStreamWriter,…
Chatterjee
  • 299
  • 2
  • 9