buffer

how to implement an implement Buffer for socket send/recv ?

i need a Buffer class for socket send/recv : 1.memmove/memcpy as less as possible 2.object creation as less as possible 3.the class user need no worry for the extend issue is there anything liks that in the standard library ? or how can i make one ? i wrote this but i can't use it for socket, because the buffer(from the standard library...

Example of a buffer overflow leading to a security leak

I read many articles about unsafe functions like strcpy, memcpy, etc. which may lead to security problems when processing external data, like the content of a file or data coming from sockets. This may sound stupid, but I wrote a vulnerable program but I did not manage to "hack" it. I understand the problem of buffer overflow. Take this...

Android AudioTrack buffering problems

Ok so I have a frequency generator which uses AudioTrack to send PCM data to the hardware. Here's the code I'm using for that: private class playSoundTask extends AsyncTask<Void, Void, Void> { float frequency; float increment; float angle = 0; short samples[] = new short[1024]; @Override protected void onPreExecute() { ...

Producer/Consumer, Stream buffer problem

I'm trying to write a buffermanager that manages 3 Streams. The typical usage would be with a slow producer and a fast consumer. The idea behind the three buffers is that the producer ALWAYS has a buffer to write in and the consumer ALWAYS gets the latest data produced. Now i already have this, and it sort-off works. namespace YariIfSt...

Oracle NCLOB Problem

I have the following function: CREATE OR REPLACE FUNCTION GetVarchar2 (iclCLOB IN Nvarchar2) return NVARCHAR2 IS cnuMAX_LENGTH Constant number := 32767 ; nuLength Number := DBMS_LOB.getlength(iclCLOB); sbBuffer Nvarchar2(32767); begin dbms_lob.read(iclCLOB,nuLength,1,sbBuffer); return sbBuffer; END; when I call it like this: select G...

Infinite ByteBuffer in Java.

I'm working on a program where I'm compressing a large amount on information and storing it in bytes in a buffer. I can't use ByteBuffer because I don't know the finall size. What would be a better way to implement this? Thanks, ...

Guess a buffer size and recall an api function or call it everytime twotimes to get exact buffer size

I want to retrieve the version information of msi-package(s) What's the better way? First: Guessing a buffer that is large enough and recall if it doesn't fit (ERROR_MORE_DATA) 1 func call vs. 3 func calls and buffer can be bigger then needed Second: Call the api function to get the buffer size and then recall it to get the string w...

Does a Buffered ObjectInputStream exist?

I am deserializing an object from a file that is 350KB in size, and its taking rather a long time. My computer science TA told me that there is a way to use a Buffered reader along with the ObjectInputStream to greatly increase performance. I however can not find anything about this on Google. ...

PHP output messages while script in process

For example i'm looping through a big file, and after counter reaches 1000 parsed strings i need to echo message, that 1000 string have been parsed and calculate % of overall completed strings. Is it possible to make something like that with output buffer? ...

Linux socket buffered data size

Is there any simple functions to check how much data is buffered but unread? FD_ISSET only indicates the presence of data in the buffer. Is possible not to create a second buffer in the program for greater control of buffer? ...

How to avoid the buffer mechanism from FileSystem

Take VirtualBox's virtual disk as example:if VirtualBox didn't avoid the buffer mechanism from FileSystem in host os,the FileSystem in guest os would move data from memory to meory. In fact ,I want to write a filesystem in user space(put all directorys and files in a single big file). But if I use c api such fread and fwrite ,the FileS...

Android max ping size less than 64K

Hi, doing some tests with my ADP1 (version 1.6) I noticed that the maximum ping that I can send when it's connected with wifi (ad.hoc or with a router) is of 57740 bytes, shouldn't be 64K? I think it's related with the receiving buffer, do somebody know how to modify it or how to get information about it? ...

"Buffers have not been created" ... whilst creating buffers.

I have (what I thought was) a straightforward BufferStrategy for a JFrame. It is created like so: // Buffer container.createBufferStrategy(2); strategy = container.getBufferStrategy(); However, occassionally I receive the following error (which points to the first line of the preceeding snippet as the offending ...

How to get around the performance issues with Buffer.put() and Android OpenGL

It is a Java issue in general, though in this particular case I am using Vertex Arrays in Android for OpenGL. To use this basic GL system, you must use Java's Buffer system in native allocation mode. This is very slow on Java. And roughly 40-50% of my entire application's time is spent inside of buffer.put(). Is there any way to speed t...

Data integrity question when collecting STDOUTs from multiple remote hosts over SSH

Suppose you run the following commands: ssh $host1 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' > /tmp/output ssh $host2 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output ssh $host3 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output Then the output would look like: ...

Question on how to copy a byte array buffer to a byte pointer in Visual C++...

Hello all. I'm posting my first question here after having viewed many useful exchanges by others; it's very exciting! I'm thinking that this question will be fairly straightforward to answer, but I hope that someone can shed some light on it since its vexing me. I have a function that accepts an array of bytes passed in as a byte p...

One MPMoviePlayerController instance can buffer two video resources (URL) at the same time?????

Hi,all. I hope a player can buffer two movies at the same time so that i can play the first movie and the other buffering at the same time .if the first one played finished ,the second can continue to play Immediately。 One MPMoviePlayerController instance can buffer two video resources (URL) at the same time????? hope your ideas,thank ...

Generating a DTMF tone doesn't work - application crashes!

Hi, I want to generate a custom DTMF tone and play it on the iPhone. In order to do so, I have created and allocated a memory buffer with a custom tone (ptr). Now I want to create a NSData object, initialized with the memory buffer, and pass it to AVAudioPlayer using initWithData:error: instance method. I wrote the following code, but ...

Generating a tone using DTMF and playing it with AVAudioPlayer.

I want to generate a custom DTMF tone and play it on the iPhone. In order to do so, I have created and allocated a memory buffer with a custom tone (ptr). Now I want to create a NSData object, initialized with the memory buffer, and pass it to AVAudioPlayer using initWithData:error: instance method. I wrote the following code, but when ...

How to remove nulls from byte array?

For some reason, the byte array output of BeginReceive fills up with nulls and then the data. BeginReceive: AsyncResult = connectSocket.BeginReceive(RecvBuffer2, 0, RecvBuffer2.Length, SocketFlags.None, OnDataRe...