Package io.netty.channel.sctp

Examples of io.netty.channel.sctp.SctpFrame


    /**
     * After connection is initialized, start the echo from client
     */
    @Override
    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent stateEvent) {
        stateEvent.getChannel().write(new SctpFrame(0, 0, ChannelBuffers.wrappedBuffer("SCTP ECHO".getBytes())));
    }
View Full Code Here


    protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
        if (!(msg instanceof SctpFrame)) {
            return msg;
        }
        final SctpChannel sctpChannel = (SctpChannel) channel;
        final SctpFrame sctpFrame = (SctpFrame) msg;

        if (inboundStreamFilter.filter(sctpChannel, sctpFrame)) {

            final boolean complete = sctpFrame.getMessageInfo().isComplete();
            if (complete) {
                if (cumulation == null) {
                    return sctpFrame.getPayloadBuffer();
                } else {
                    final ChannelBuffer extractedFrame = ChannelBuffers.wrappedBuffer(cumulation, sctpFrame.getPayloadBuffer());
                    cumulation = null;
                    return extractedFrame;
                }
            } else {
                if (cumulation == null) {
                    cumulation = sctpFrame.getPayloadBuffer();
                } else {
                    cumulation = ChannelBuffers.wrappedBuffer(cumulation, sctpFrame.getPayloadBuffer());
                }
                return null;
            }
        } else {
            return msg;
View Full Code Here

        if (!(msg instanceof ChannelBuffer)) {
            return msg;
        } else {
            SctpChannel sctpChannel = (SctpChannel) channel;
            final int streamIdentifier = sctpWriteStreamSelector.streamIdentifier(sctpChannel, msg);
            return new SctpFrame(protocolIdentifier, streamIdentifier, (ChannelBuffer) msg);
        }
    }
View Full Code Here

TOP

Related Classes of io.netty.channel.sctp.SctpFrame

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.