Multiple slaves on the same TCP port

391 views
Skip to first unread message

matt T

unread,
Oct 21, 2013, 7:45:11 PM10/21/13
to open...@googlegroups.com
Hi all,

I would like to create multiple slaves listen on the same TCP port. In other word, multiple masters at different IP addresses establish separate TCP connections with the slaves on the same port number (for example, 20000). Similar to how the regular ssh daemon or web server, multiple clients can establish separate channels to server on the same port (for example, 22 or 80).

It appears to me that the open-dnp3 does not do this. AddTCPServer() is able to create another TCP channel. However, the listening TCP port needs to be different (for example, two slaves need to use different ports 20000, 22000).

My questions are:
Is my understanding of the open-dnp3 code correct?
If not, how do I achieve this?
If yes, I wonder if there is any reason that the open-dnp3 works this way? Any upcoming plan to address this?


Thank you all for the answers.

Daniel Evans

unread,
Oct 21, 2013, 8:52:43 PM10/21/13
to open...@googlegroups.com
There are two steps, AddTCPServer() and AddSlave(). TCP "server" just means it's a bind/accept socket, not that the object represents the entire stack. Add a single TCP server, then add two or more slaves (with different DNP remote addresses) with the (same) port/channel name of the tcp server.




--
You received this message because you are subscribed to the Google Groups "open-dnp3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-dnp3+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Chris Verges

unread,
Oct 21, 2013, 9:24:38 PM10/21/13
to open...@googlegroups.com, open...@googlegroups.com
Hi Matt,

To add to Daniel's answer, OpenDNP3 doesn't fork when accepting a socket, so only one TCP client can connect to a TCPServer port at a time.  There are some feature requests already filed around this.

Chris


matt T

unread,
Oct 21, 2013, 9:39:06 PM10/21/13
to open...@googlegroups.com
Hi Chris,

Thank you. What Daniel described is exactly what I had.

That answers my doubt.



--
You received this message because you are subscribed to a topic in the Google Groups "open-dnp3" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/open-dnp3/8vcHMx5U3kA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to open-dnp3+...@googlegroups.com.

Adam Crain

unread,
Oct 21, 2013, 9:44:33 PM10/21/13
to open...@googlegroups.com
There are plans to add multi-master support in the next iteration.

I really need to write this up in the FAQ, because this question has been asked many times.

DNP3 is special (not in a good way).  It saves state for particular masters in event buffers. Because of this, you can't treat all connecting masters the same.  In the next iteration of the Automatak branch we'll be able to create multiple virtual channels that bind to the same listening port.  Each one will connect to IP addresses or * wildcards.  This is how other single port / multi connection implementations work.

It would have been cool if DNP3 had been implemented in a way that a connecting master requests a limited history, since the last time it connected allowing playback and therefore enabling a "restful" server (outstation)... but alas, it is not.

-Adam


matt T

unread,
Oct 22, 2013, 12:13:40 AM10/22/13
to open...@googlegroups.com
Hi Adam, Thank you for the explanation. Since you mentioned the Automatak branch here, would you kindly point out where the future development of these two branches are heading?


Matt

Adam Crain

unread,
Oct 22, 2013, 11:43:29 AM10/22/13
to open...@googlegroups.com
If you want specifics on the road-map for the other branch, you'll have to ask them on that list. I try to help answer cross-cutting questions on both lists like the current security research, but I won't cross streams here anymore than I already have.

I've described what I think is the right way to implement the multi-master feature in either branch.

-Adam
Reply all
Reply to author
Forward
0 new messages