/// <summary> /// Initializes an instance of <see cref="DicomClient"/>. /// </summary> /// <param name="host">DICOM host.</param> /// <param name="port">Port.</param> /// <param name="useTls">True if TLS security should be enabled, false otherwise.</param> /// <param name="callingAe">Calling Application Entity Title.</param> /// <param name="calledAe">Called Application Entity Title.</param> /// <param name="clientOptions">The options that further modify the behavior of this DICOM client</param> /// <param name="serviceOptions">The options that modify the behavior of the base DICOM service</param> /// <param name="networkManager">The network manager that will be used to connect to the DICOM server</param> /// <param name="logManager">The log manager that will be used to extract a default logger</param> /// <param name="transcoderManager">The transcoder manager that will be used to transcode incoming or outgoing DICOM files</param> public DicomClient(string host, int port, bool useTls, string callingAe, string calledAe, DicomClientOptions clientOptions, DicomServiceOptions serviceOptions, INetworkManager networkManager, ILogManager logManager, ITranscoderManager transcoderManager) { Host = host; Port = port; UseTls = useTls; CallingAe = callingAe; CalledAe = calledAe; ClientOptions = clientOptions; ServiceOptions = serviceOptions; QueuedRequests = new ConcurrentQueue <StrongBox <DicomRequest> >(); AdditionalPresentationContexts = new List <DicomPresentationContext>(); AdditionalExtendedNegotiations = new List <DicomExtendedNegotiation>(); AsyncInvoked = 1; AsyncPerformed = 1; State = new DicomClientIdleState(this); NetworkManager = networkManager ?? throw new ArgumentNullException(nameof(networkManager)); TranscoderManager = transcoderManager ?? throw new ArgumentNullException(nameof(transcoderManager)); LogManager = logManager ?? throw new ArgumentNullException(nameof(logManager)); Logger = logManager.GetLogger("FellowOakDicom.Network"); }
/// <summary> /// Initializes an instance of <see cref="DicomServer{T}"/>, that starts listening for connections in the background. /// </summary> /// <param name="port">Port to listen to.</param> /// <param name="certificateName">Certificate name for authenticated connections.</param> /// <param name="options">Service options.</param> /// <param name="logger">Logger.</param> public JpDicomServer(int port, string certificateName = null, DicomServiceOptions options = null, Logger logger = null) { this.port = port; this.certificateName = certificateName; this.clients = new List <T>(); this.Options = options; this.Logger = logger ?? LogManager.GetLogger("Dicom.Network"); this.IsListening = false; this.Exception = null; this.disposed = false; }
public IDicomServer CreateListener(List <IDicomServer> dicomListeners) { var taskStatus = $"{Connection.name}:"; // will need to handle a change at some point var result = dicomListeners.Find(a => a.Port == Connection.localPort); if (result != null) { // already exist! return(null); } DicomServiceOptions dsoptions = new DicomServiceOptions { IgnoreSslPolicyErrors = Connection.IgnoreSslPolicyErrors, IgnoreUnsupportedTransferSyntaxChange = Connection.IgnoreUnsupportedTransferSyntaxChange, LogDataPDUs = Connection.LogDataPDUs, LogDimseDatasets = Connection.LogDimseDatasets, MaxClientsAllowed = Connection.MaxClientsAllowed, MaxCommandBuffer = Connection.MaxCommandBuffer, MaxDataBuffer = Connection.MaxDataBuffer, MaxPDVsPerPDU = Connection.MaxPDVsPerPDU, TcpNoDelay = Connection.TcpNoDelay, UseRemoteAEForLogName = Connection.UseRemoteAEForLogName }; var hostEntry = Dns.GetHostEntry(Connection.localHostname); string ipaddress = null; foreach (var ip in hostEntry.AddressList) { // if (ip.AddressFamily == AddressFamily.InterNetworkV6) // { ipaddress += ip.ToString() + ","; // } } _logger.Log(LogLevel.Information, $"{taskStatus} Attempting to create DICOM listener on ip {ipaddress} port {Connection.localPort}"); //todo: send DICOM logger. WHY??? //var dicomServer = DicomServer.Create<DicomListener>(ipaddress.TrimEnd(','), Convert.ToInt32(Connection.localPort), this, null, dsoptions, null, logger: Logger.logger); var dicomServer = DicomServer.Create <DicomListener>(ipaddress.TrimEnd(','), Convert.ToInt32(Connection.localPort), this, null, dsoptions, null); return(dicomServer); }
public void SetupDicomServiceOptions() { dicomClient.Linger = Connection.Linger; //todo: send DICOM logger. WHY??? //dicomClient.Logger = Logger.logger; dicomClient.NegotiateAsyncOps(Connection.asyncInvoked, Connection.asyncPerformed); DicomServiceOptions dsoptions = new DicomServiceOptions { IgnoreSslPolicyErrors = Connection.IgnoreSslPolicyErrors, IgnoreUnsupportedTransferSyntaxChange = Connection.IgnoreUnsupportedTransferSyntaxChange, LogDataPDUs = Connection.LogDataPDUs, LogDimseDatasets = Connection.LogDimseDatasets, MaxClientsAllowed = Connection.MaxClientsAllowed, MaxCommandBuffer = Connection.MaxCommandBuffer, MaxDataBuffer = Connection.MaxDataBuffer, MaxPDVsPerPDU = Connection.MaxPDVsPerPDU, TcpNoDelay = Connection.TcpNoDelay, UseRemoteAEForLogName = Connection.UseRemoteAEForLogName }; dicomClient.Options = dsoptions; }