There is way for TcpClient to assign local outgoing port as described here.
Is it possible to have the same functionality for fo-DICOM DicomClient?
This is necessary because the server is listening for a connection from a specific client port only.
This answer is applicable to older (4.0.1.0 or nearby) versions of fo-DICOM. With latest version, the classes and methods mentioned in this answer are deprecated.
Using overload of
DicomClient.Sendmethod, theINetworkStreamcan be used to provide local outgoing port while working as SCU using fo-DICOM.As an example, there are four methods available for CSTORE as SCU. First two are:
The
hostandportare remote host and remote port. None of it acceptIPEndPointas parameter.Now, look at other two methods:
Those accept
INetworkStreamwhich looks like below:This allow providing
LocalPortto you. You need to write implementation for that interface. Not sure ifDesktopNetworkStream(implementation ofINetworkStream) can be used directly.