Closed sureshbalakundi closed 7 years ago
Set the "initialbytestostrip" to 0:
LengthFieldBasedFrameDecoder(uint32_t lengthFieldLength = 4, uint32_t maxFrameLength = UINT_MAX, uint32_t lengthFieldOffset = 0, int32_t lengthAdjustment = 0, uint32_t initialBytesToStrip = 0, bool networkByteOrder = true);
Im decoding LengthFieldBasedFrameDecoder format. when I'm Decoding Length is not coming. Please Suggest me How i need to decode. please find the below program
class EchoHandler : public HandlerAdapterstd::string { public: virtual void read(Context* ctx, std::string msg) override { LOG(INFO) << "Recieving Time"; /* Here Im Decoding the Buffer but Content Length is Not able to Read *//
} }; class EchoPipelineFactory : public PipelineFactory {
public:
EchoPipeline::Ptr newPipeline(std::shared_ptr sock) {
auto pipeline = EchoPipeline::create();
pipeline->addBack(AsyncSocketHandler(sock));
pipeline->addBack(LengthFieldBasedFrameDecoder());
pipeline->addBack(LengthFieldPrepender());
pipeline->addBack(StringCodec());
pipeline->addBack(EchoHandler());
pipeline->finalize();
return pipeline;
}
};
int main(int argc, char\ argv) { google::ParseCommandLineFlags(&argc, &argv, true);
ServerBootstrap server;
server.childPipeline(std::make_shared());
server.bind(FLAGS_port);
server.waitForStop();
return 0; }