www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Q on efficient network data handling

reply ikod <geller.garry gmail.com> writes:
Hello,

Several times I encountered one problem and each time I had to 
solve it again. As a result, I created the nbuff package, but 
maybe there is a ready solution and I wasted time?

The context is this - the program accepts data from the network 
and process it (examples are parsing HTTP headers, deserializing 
a network data stream, searching patterns in a network stream).

The problem is that the data comes in arbitrary chunks and you 
have to collect data into a continuous buffer(which means a lot 
of copying in memory) to use standard algorithms such as find, 
split, etc.

I made a nbuff package for myself that creates a buffer and keep 
unconcatenated data chunks, but support standard algorithms as it 
support several range properties.

How do you solve this problem? Is there something in std that can 
be used here?

Thanks!
Jul 11 2019
parent Rene Zwanenburg <renezwanenburg gmail.com> writes:
On Thursday, 11 July 2019 at 16:09:54 UTC, ikod wrote:
 Hello,

 Several times I encountered one problem and each time I had to 
 solve it again. As a result, I created the nbuff package, but 
 maybe there is a ready solution and I wasted time?

 (...)

 Thanks!
The iopipe library may cover your needs. I have not used it myself so I'm not sure. http://code.dlang.org/packages/iopipe
Jul 12 2019