Multiple Sessions for Bidirectional Connections

Some use cases require to establish more than one connection at a time.

DICOM communication is a good example for situations that require two seperate connections in different directions: One to a distant server and another from that server back to your device.

It would look like this in radiology:
For querying and retrieving images from a PACS server, two different connections are used: The physician searches and requests the desired images using a DICOM viewer over a first connection initiated by the viewer. As a result, the PACS server sends the relevant data back to the viewer using a second connection that is triggered by the server.

In order to simplify this constellation in a radiological setting with remote locations, it is possible to automatically launch ButConnect several times with different configurations.

To achieve this, at the end of one configuration section in the .ini file, the next can be invoked as a kind of follow-up connection.

For example:

[DICOM]
mode = getaccess
server = <ssh_server>
port = <ssh_port>
user = <ssh_user>
ident = <ssh_key>
rhost = 10.1.0.4 #
rport = 104 # The PACS server is listening on '10.1.0.4:104', ...
lhost = 127.1.0.40 #
lport = 1040 # ... but we pretend to talk to '127.1.0.40:1040'.
; start = ButConnect.exe
param = "-cn=_REVERSE_"

[_REVERSE_]
mode = letaccess
server = <ssh_server>
port = <ssh_port>
user = <ssh_user>
ident = <ssh_key>
rhost = 10.1.0.24 # <-- internal IP address of <ssh_server>
rport = 1024 # <-- port <ssh_server> will listen on
lhost = 127.1.1.112 # The remote server needs to talk to '10.1.0.24:1024' ...
lport = 11112 # ... in order to reach our viewer at '127.1.1.112:11112'.
start = <dicom_viewer> [-aet <application entity title>] [[$LHOST:]$LPORT]

# To be able to establish such a reverse connection ("letaccess"),
# it would be necessary to allow SSH port forwarding from remote hosts.
# To do that, you could include and uncomment
#GatewayPorts yes
# or
#GatewayPorts clientspecified
# in the SSH server's '/etc/ssh/sshd_config' file.
# (Please refer to the SSH documentation first.)

To invoke another ButConnect session, the start parameter can be omitted. If only the param entry is present, ButConnect launches the next session within the current console window. Otherwise, a new instance is created.

All sections whose names start and end with an underscore (such as ‘_REVERSE_’) are interpreted as auxiliary sections and are therefore not offered as a connection entry when cycling through the list of available connections, but are still used to establish multiple sessions.