namespace Universal.IO;


public interface ITcpClient : IFilter, IDisposable
{
    bool Initiallize(string name);

    bool Open(string remoteHost, ushort remotePort, out TcpConnection? tcpConnection, string? localHost = null, ushort localPort = 0, bool noDelay = false, int timeout = 1000, int receiveBufferSize = 4096);
    bool Close();
}

public interface ITcpServer : IFilter, IDisposable
{
    bool Initialize(string name);

    bool Open(string ip, ushort port, bool noDelay = true, int receiveBufferSize = 4096);
    bool Close();
}

public interface IModBus<T_buffer> 
{
    bool Initialize(string name);

    T_buffer GetBuffer(ushort index, ushort count, byte slaveAddress = 1);
    bool SetUshort(ushort index, ushort value, byte slaveAddress = 1);
    bool SetValue<T>(ushort index, T value, byte slaveAddress = 1) where T : struct;
    bool SetFloat(ushort index, float value, byte slaveAddress = 1);
    bool Open(string ip, ushort port);
    bool Close();
}