Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single OutstationServer add multiple Outstation #299

Closed
Roach0857 opened this issue Apr 20, 2023 · 4 comments
Closed

Single OutstationServer add multiple Outstation #299

Roach0857 opened this issue Apr 20, 2023 · 4 comments

Comments

@Roach0857
Copy link

Hi,
I try to add multiple OutStations to a single OutstationServer,
but I got
dnp3.ParamException: 'AddressFilterConflict'
I know every Outstation AddressFilter cannot accept the same IP.
According to the AddressFilter summary:

// 摘要:
// Filters connecting client by their IP address to associate a connecting master
// with an outstation on the server

but I want to build a single OutstationServer, add multiple OutStations which can accept the same IP or accept the all IP

@jadamcrain
Copy link
Member

but I want to build a single OutstationServer, add multiple OutStations which can accept the same IP or accept the all IP

This isn't possible. DNP3 is a state-ful protocol which buffers events for specific master stations:

https://docs.stepfunc.io/dnp3/1.3.0/guide/docs/api/outstation/tcp_server

@Roach0857
Copy link
Author

but when I use opendnp3 by C++,as below

    const auto logLevels = levels::NORMAL | levels::ALL_COMMS;
    // This is the main point of interaction with the stack
    // Allocate a single thread to the pool since this is a single outstation
    // Log messages to the console
    DNP3Manager manager(1, ConsoleLogger::Create());

    // Create a TCP server (listener)
    auto channel = std::shared_ptr<IChannel>(nullptr);
    try
    {
        channel = manager.AddTCPServer("server", logLevels, ServerAcceptMode::CloseExisting,
                                       IPEndpoint("0.0.0.0", 20000), PrintingChannelListener::Create());
    }
    catch (const std::exception& e)
    {
        std::cerr << e.what() << '\n';
        return -1;
    }

    OutstationStackConfig config(ConfigureDatabase());
    config.outstation.eventBufferConfig = EventBufferConfig::AllTypes(100);
    config.outstation.params.allowUnsolicited = true;
    config.link.LocalAddr = 4;
    config.link.RemoteAddr = 3;
    config.link.KeepAliveTimeout = TimeDuration::Max();
    auto outstation = channel->AddOutstation("99-99-9999-99-9", SuccessCommandHandler::Create(), app, config);
    outstation->Enable();

    OutstationStackConfig config2(ConfigureDatabase());
    config2.outstation.eventBufferConfig = EventBufferConfig::AllTypes(100);
    config2.outstation.params.allowUnsolicited = true;
    config2.link.LocalAddr = 5;
    config2.link.RemoteAddr = 3;
    config2.link.KeepAliveTimeout = TimeDuration::Max();
    auto outstation2 = channel->AddOutstation("88-88-8888-88-8", SuccessCommandHandler::Create(), app, config2);
    outstation2->Enable();

I can create one channel (one TCP Server), add two Outstation to this channel and this code can run.
why?

@jadamcrain
Copy link
Member

jadamcrain commented Apr 24, 2023

OpenDNP3 and the new Rust library support different features.

  1. OpenDNP3 supports "multi-drop" where you can have multiple addresses (e.g. virtual outstations) talking on single socket connection. We plan to add this feature to the Rust in library in 2.0.

  2. The new library allows a single TCP server to route connection requests to different outstation instances based on the connecting IP address. OpenDNP3 never supported this. When you originally submitted this question, I thought you were asking about this feature.

In 2.0, this library will be able to do both.

@Roach0857
Copy link
Author

OpenDNP3 and the new Rust library support different features.

  1. OpenDNP3 supports "multi-drop" where you can have multiple addresses (e.g. virtual outstations) talking on single socket connection. We plan to add this feature to the Rust in library in 2.0.
  2. The new library allows a single TCP server to route connection requests to different outstation instances based on the connecting IP address. OpenDNP3 never supported this. When you originally submitted this question, I thought you were asking about this feature.

In 2.0, this library will be able to do both.

I understand, thanks for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants