All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iteaj.iot.client.component.FixedLengthFrameClientComponent Maven / Gradle / Ivy

The newest version!
package com.iteaj.iot.client.component;

import com.iteaj.iot.client.ClientConnectProperties;
import com.iteaj.iot.client.ClientMessage;
import com.iteaj.iot.client.MultiClientManager;
import com.iteaj.iot.client.TcpSocketClient;
import com.iteaj.iot.client.codec.FixedLengthFrameClient;

/**
 * 使用固定长度解码器的客户端组件
 * @see FixedLengthFrameClient
 * @see io.netty.handler.codec.FixedLengthFrameDecoder
 * @param 
 */
public abstract class FixedLengthFrameClientComponent extends TcpClientComponent {

    private int frameLength;

    public FixedLengthFrameClientComponent(ClientConnectProperties config, int frameLength) {
        super(config);
        this.frameLength = frameLength;
    }

    public FixedLengthFrameClientComponent(ClientConnectProperties config, MultiClientManager clientManager, int frameLength) {
        super(config, clientManager);
        this.frameLength = frameLength;
    }

    @Override
    public TcpSocketClient createNewClient(ClientConnectProperties config) {
        return new FixedLengthFrameClient(this, config, this.frameLength);
    }

    public int getFrameLength() {
        return frameLength;
    }

    public void setFrameLength(int frameLength) {
        this.frameLength = frameLength;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy