Hi,

I send it in this way, but it cannot guarantee the continuation frame is
sent in the specific stream and session or using the http2 protocol. Am I
right?

SocketChannel socketChannel = SocketChannel.open();

socketChannel.connect(new InetSocketAddress("127.0.0.1", 443));

for (ByteBuffer buffer : buffers)

{

    socketChannel.write(buffer);

    Thread.sleep(1000);

}


And Also java will raise the exception

java.io.IOException: Broken pipe

at sun.nio.ch.FileDispatcherImpl.write0(Native Method)

at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)

at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)

at sun.nio.ch.IOUtil.write(IOUtil.java:65)

at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)


Thank you very much.

Best Regards

Muhui Jiang

2015-10-13 16:35 GMT+08:00 Simone Bordet <[email protected]>:

> Hi,
>
> On Tue, Oct 13, 2015 at 9:39 AM, Muhui Jiang <[email protected]> wrote:
> > Hi,
> >
> > Simone, Thanks for your detailed suggestions.
> > So in your code, you mean
> >
> > List<ByteBuffer> buffers = lease.getByteBuffers();
> >
> > the list is the whole Continuation frames?
>
> No.
> It contains a list of buffers to write.
> The buffers are typically 2 per frame: 1 buffer containing the header
> bytes, 1 buffer containing the body bytes.
>
> > But how can I write the continuation frame to the server periodically. I
> > tried to use
> >
> > session.newStream(headers,
> >
> > new Promise.Adapter<>(), new Stream.Listener.Adapter() {}
> >
> > this way to send the headers but the result is that I can get the whole
> > headersframe immediately.
>
> Sure that will send a whole HEADERS frame.
>
> You need to generate the buffers with the Generator and then write the
> buffers one at a time.
>
> > My question is how to write the buffer(Continuation frame) into the
> server
> > periodically then the server can not get my whole headers frame in a
> short
> > time. Many thanks.
>
> List<ByteBuffer> buffers = lease.getByteBuffers();
> for (ByteBuffer buffer : buffers)
> {
>     socketChannel.write(buffer);
>     Thread.sleep(1000);
> }
>
> Alternatively, you can just generate the buffers and then continuously
> send the same couple of buffers over and over.
>
> buffers[0] = HEADERS header bytes
> buffers[1] = HEADERS body bytes
> buffers[2] = CONTINUATION #1 headers bytes
> buffers[3] = CONTINUATION #1 body bytes
> buffers[4] = CONTINUATION #2 headers bytes
> buffers[5] = CONTINUATION #2 body bytes
> etc.
>
> --
> Simone Bordet
> ----
> http://cometd.org
> http://webtide.com
> Developer advice, training, services and support
> from the Jetty & CometD experts.
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to