bformat 3.1.19

Bformat message encoder/decoder for streams and sockets


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

bformat

D

A simple message format for automatically length-prefixing messages over any Socket.

What is bformat?

bformat is simply a format and a library that allows one to prefix their messages with a length field such that it can be retrieved on the other side over a socket that is opened in a STREAM mode. It simply manages a socket's I/O stream such that the first 4 bytes are read as the length and then the preceding bytes are read accordingly. Rather than duplicate this sort of logic in all the code I wrote ever for my networking projects, I decided to make it a library as it would reduce the amount of duplicate code and also allow code re-use of something I could change or optimize later.

It's also cross-platform and does all the byte-swapping endianess goodness you'd need - so you need not worry about that.

Want to use it in your project?

It's rather easy to add it to your D project (so far I have only implemented this in DLang as that is where I need it).

Just run the command dub add bformat.

When using the library you will want to use the two functions provided sendMessage(Socket, byte[]) and receiveMessage(Socket, ref byte[]). These two functions allow you to send data and have it encoded into the bformat format and receive data and interpret the received bformat format such that the correct length of data can read.

And then you can take a look at the source code documentation here on the functions the library provides and how to use them.

Authors:
  • Tristan B. Velloza Kildaire
Dependencies:
none
Versions:
5.0.0 2023-Oct-01
4.1.5 2023-Oct-01
4.1.4 2023-Oct-01
4.1.3 2023-Oct-01
4.1.2 2023-Jun-18
Show all 49 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 392 downloads total

Score:
0.2
Short URL:
bformat.dub.pm