簡體   English   中英

fo-DICOM:如何在 DicomClient 中指定本地傳出端口?

[英]fo-DICOM: How to specify the local outgoing port in DicomClient?

TcpClient可以按照此處所述分配本地傳出端口。

fo-DICOM DicomClient是否可以具有相同的功能?

這是必要的,因為服務器僅偵聽來自特定客戶端端口的連接。

此答案適用於舊版本(4.0.1.0 或附近)的 fo-DICOM。 對於最新版本,不推薦使用此答案中提到的類和方法。


使用DicomClient.Send方法的重載, INetworkStream可用於提供本地傳出端口,同時使用 fo-DICOM 作為 SCU。

例如,有四種方法可用於 CSTORE 作為 SCU。 前兩個是:

public void Send(string host, int port, bool useTls, string callingAe, string calledAe, int millisecondsTimeout = 5000);
public Task SendAsync(string host, int port, bool useTls, string callingAe, string calledAe, int millisecondsTimeout = 5000);

hostport是遠程主機和遠程端口。 它們都不接受IPEndPoint作為參數。

現在,看看其他兩種方法:

public void Send(INetworkStream stream, string callingAe, string calledAe, int millisecondsTimeout = 5000);
public Task SendAsync(INetworkStream stream, string callingAe, string calledAe, int millisecondsTimeout = 5000);

那些接受如下所示的INetworkStream

public interface INetworkStream : IDisposable
{
    string LocalHost { get; }
    int LocalPort { get; }
    string RemoteHost { get; }
    int RemotePort { get; }
    Stream AsStream();
}

這允許向您提供LocalPort 您需要為該接口編寫實現。 不確定是否可以直接使用DesktopNetworkStreamINetworkStream的實現)。

您已在 github 上提出問題 以下是那里的反饋:

目前不支持此功能。 您可以通過實現自己的NetworkManager並從現有的DesktopNetworkManagerDesktopNetworkStream中汲取大量靈感來解決此限制。 DesktopNetworkStream中,創建了TcpClient 這是您需要進行自己的自定義更改的地方。

看看那里對我的評論的回復,看來問題現在已經解決並且該功能現在可用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM