Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send a byte array via wangle? #71

Open
zhenyu-zhou opened this issue Oct 10, 2016 · 1 comment
Open

How to send a byte array via wangle? #71

zhenyu-zhou opened this issue Oct 10, 2016 · 1 comment

Comments

@zhenyu-zhou
Copy link

I have a byte array (actually the raw packet data) and I know its length. However, it may contain '\0' in the middle so that the example code doesn't work for me - such '\0' will be regarded as the end of string and I cannot send the whole array together to the destination.

I'm not quite familiar with Wangle and any idea for how to build a pipeline for my purpose?

Thanks!

P.S.
The pipeline in the sample code is showed below, it works perfect for the printable strings:

auto pipeline = EchoPipeline::create();
pipeline->addBack(AsyncSocketHandler(sock));
pipeline->addBack(
    EventBaseHandler()); // ensure we can write from any thread
pipeline->addBack(LineBasedFrameDecoder(8192, false));
pipeline->addBack(StringCodec());
pipeline->addBack(EchoHandler());
@djwatson
Copy link

djwatson commented Jan 6, 2017

You probably want a LengthFieldBasedFrameDecoder?

facebook-github-bot pushed a commit that referenced this issue Mar 27, 2019
Summary:
As a step in the plan to migrate LogDevice to using fbcode_builder as
the primary build method, allow LogDevice to build without submodules.
In place of the self compiled modules, the CMake scripts will look in
the system (or provided prefix locations) and use precompiled modules
there. Users can then use fbcode_builder to ensure those required
modules are built and available.

* Use new 'folly_test_util' library rather than referencing sources
directly
Pull Request resolved: facebookarchive/LogDevice#71

Reviewed By: AhmedSoliman

Differential Revision: D14578119

Pulled By: calebmarchent

fbshipit-source-id: 36400d41d3f1906919706d20d0fb53195fec2e63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants