Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:35:11+00:00 2026-06-13T18:35:11+00:00

Hello I have a Netty Server with a handler that should accept strings. It

  • 0

Hello I have a Netty Server with a handler that should accept strings. It seems to only receive content up to 1024 bytes. How can i increase Buffer size. I have already tried

bootstrap.setOption("child.sendBufferSize", 1048576); 
bootstrap.setOption("child.receiveBufferSize", 1048576);

without success.

The handler is as below

public class TestHandler extends SimpleChannelHandler {


@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {

    ChannelBuffer buf = (ChannelBuffer) e.getMessage();

    String response = "";

    if (buf.readable()) {

        response = buf.toString(CharsetUtil.UTF_8);
        System.out.println("CONTENT: " + response);
    }

    System.out.println(response);


}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
    e.getCause().printStackTrace();

    Channel ch = e.getChannel();
    ch.close();
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:35:13+00:00Added an answer on June 13, 2026 at 6:35 pm

    Are you using UDP ? If so, packets will max out at 1024 bytes. This code comment is in the QOTM code sample:

    Allow packets as large as up to 1024 bytes (default is 768). You could
    increase or decrease this value to avoid truncated packets or to
    improve memory footprint respectively.

    Please also note that a large UDP packet might be truncated or dropped
    by your router no matter how you configured this option. In UDP, a
    packet is truncated or dropped if it is larger than a certain size,
    depending on router configuration. IPv4 routers truncate and IPv6
    routers drop a large packet. That’s why it is safe to send small
    packets in UDP.

    If you are using TCP, you should add a frame decoder and a string decoder into your pipeline before yout handler; Something like this:

    pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(80960, Delimiters.lineDelimiter()));
    pipeline.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8));
    pipeline.addLast("myHandler", new TestHandler());
    

    Mind you, you will need to modify your test handler because the MessageEvent will actually contain your string.

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
        String response = (String) e.getMessage();
        System.out.println(response);
    }
    

    Make sense ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello I have my code that connects to my ftp server $conn_id = ftp_connect($ftp_server);
Hello i have this foreach loop that gives weird result , it displays only
Hello I have a datatable that I would like to filter with a single
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello i have been trying to find a tutorial that show how to setup
hello I have a page ( http://schema.org/WebPage ) that contains a review ( http://schema.org/Review
Hello i have that grid pane and there is labels and textboxes in that
Hello have only a few days with Java and android here. I am a
Hello i have a TextField on my scene. It haves only digits, user input
Hello I have a jQuery to open picture only in browser visible area: $(document).ready(function()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.