public static void Start(int port, string aet, List <WorklistItem> list) { AETitle = aet; _server = DicomServer.Create <WorklistService>(port); // every 30 seconds the worklist source is queried and the current list of items is cached in _currentWorklistItems _itemsLoaderTimer = new Timer((state) => { if (list.Count != 0) { CurrentWorklistItems = list; } else { var newWorklistItems = CreateItemsSourceService.GetAllCurrentWorklistItems(); CurrentWorklistItems = newWorklistItems; } }, null, TimeSpan.Zero, TimeSpan.FromSeconds(30)); }
private static void Main(string[] args) { // preload dictionary to prevent timeouts var dict = DicomDictionary.Default; // start DICOM server on port from command line argument or 11112 int tmp; var port = args != null && args.Length > 0 && int.TryParse(args[0], out tmp) ? tmp : 11113; Console.WriteLine($"Starting C-Store SCP server on port {port}"); var server = DicomServer.Create <CFindSCP>(port); // end process Console.WriteLine("Press <return> to end..."); Console.ReadLine(); }
public async Task DicomClientShallNotCloseConnectionTooEarly_CEchoSerialAsync(int expected) { var port = Ports.GetNext(); using (var server = DicomServer.Create <DicomCEchoProvider>(port)) { while (!server.IsListening) { await Task.Delay(50); } var actual = 0; var client = new DicomClient(); for (var i = 0; i < expected; i++) { client.AddRequest( new DicomCEchoRequest { OnResponseReceived = (req, res) => { output.WriteLine("Response #{0} / expected #{1}", actual, req.UserState); Interlocked.Increment(ref actual); output.WriteLine(" #{0} / expected #{1}", actual - 1, req.UserState); }, UserState = i } ); output.WriteLine("Sending #{0}", i); await client.SendAsync("127.0.0.1", port, false, "SCU", "ANY-SCP", 600 * 1000); output.WriteLine("Sent (or timed out) #{0}", i); if (i != actual - 1) { output.WriteLine(" waiting #{0}", i); await Task.Delay((int)TimeSpan.FromSeconds(1).TotalMilliseconds); output.WriteLine(" waited #{0}", i); } } Assert.Equal(expected, actual); } }
public async Task RetrieveAsync(DicomCMoveRequest request, Func <DicomDataset, Task <bool> > storeHandler, int destinationPort) { var server = (DicomStoreServer)DicomServer.Create <DicomStoreService, DicomStoreServer>(null, destinationPort); server.AeTitle = request.DestinationAE; server.OnCStoreRequest = cStoreRequest => storeHandler(cStoreRequest.Dataset).Result ? DicomStatus.Success : DicomStatus.QueryRetrieveUnableToPerformSuboperations; request.OnResponseReceived += (_, response) => { if (response.Status == DicomStatus.Success) { server.Dispose(); } }; var client = CreateClient(); await client.AddRequestAsync(request); await client.SendAsync(); }
private static async Task Main(string[] args) { var server = DicomServer.Create <CStoreSCP>(11112); var isService = !(Debugger.IsAttached || args.Contains("--console")); var builder = new HostBuilder() .ConfigureServices((hostContext, services) => { services.AddHostedService <FileWriterService>(); }); if (isService) { await builder.RunAsServiceAsync(); } else { await builder.RunConsoleAsync(); } }
public void OldDicomClientSend_StorePart10File_ShouldSucceed() { var port = Ports.GetNext(); using (var server = DicomServer.Create <CStoreScp>(port)) { server.Logger = _logger.IncludePrefix("CStoreScp"); var file = DicomFile.Open(@".\Test Data\CT-MONO2-16-ankle"); var client = new DicomClient { Logger = _logger.IncludePrefix("DicomClient") }; client.AddRequest(new DicomCStoreRequest(file)); var exception = Record.Exception(() => client.Send("127.0.0.1", port, false, "SCU", "SCP")); Assert.Null(exception); } }
public void DicomClientSend_TooManyPresentationContexts_YieldsInformativeException() { var port = Ports.GetNext(); using (DicomServer.Create <DicomCEchoProvider>(port)) { var client = new DicomClient(); // this just illustrates the issue of too many presentation contexts, not real world application. var pcs = DicomPresentationContext.GetScpRolePresentationContextsFromStorageUids( DicomStorageCategory.None, DicomTransferSyntax.ImplicitVRLittleEndian); client.AdditionalPresentationContexts.AddRange(pcs); var exception = Record.Exception(() => client.Send("localhost", port, false, "SCU", "SCP")); Assert.IsType <DicomNetworkException>(exception); } }
public async Task DicomClientSend_StorePart10File_ShouldSucceed() { var port = Ports.GetNext(); using (var server = DicomServer.Create <CStoreScp>(port)) { server.Logger = _logger.IncludePrefix("CStoreScp"); var file = DicomFile.Open(@".\Test Data\CT-MONO2-16-ankle"); var client = new Dicom.Network.Client.DicomClient("127.0.0.1", port, false, "SCU", "SCP") { Logger = _logger.IncludePrefix("DicomClient") }; await client.AddRequestAsync(new DicomCStoreRequest(file)).ConfigureAwait(false); var exception = await Record.ExceptionAsync(async() => await client.SendAsync()); Assert.Null(exception); } }
public async Task DicomClientShallNotCloseConnectionTooEarly_CEchoParallelAsync(int expected) { int port = Ports.GetNext(); using (var server = DicomServer.Create <DicomCEchoProvider>(port)) { while (!server.IsListening) { await Task.Delay(50); } var actual = 0; var requests = Enumerable.Range(0, expected).Select( async requestIndex => { var client = new DicomClient(); client.AddRequest( new DicomCEchoRequest { OnResponseReceived = (req, res) => { output.WriteLine("Response #{0}", requestIndex); Interlocked.Increment(ref actual); } } ); output.WriteLine("Sending #{0}", requestIndex); await client.SendAsync("127.0.0.1", port, false, "SCU", "ANY-SCP", 600 * 1000); output.WriteLine("Sent (or timed out) #{0}", requestIndex); } ).ToArray(); await Task.WhenAll(requests); Assert.Equal(expected, actual); } }
/// <inheritdoc /> /// <exception cref="DicomNetworkException">If the service is already listening.</exception> /// <exception cref="System.Net.Sockets.SocketException">If another service is already listening on this socket.</exception> public bool StartServer(int port, Func <IReadOnlyDictionary <DicomUID, DicomTransferSyntax[]> > getAcceptedTransferSyntaxes, TimeSpan timeout) { if (!ApplicationEntityValidationHelpers.ValidatePort(port)) { throw new ArgumentException("The port is not valid.", nameof(port)); } // Check if we are already listening if (IsListening) { throw new DicomNetworkException("We are already listening. Please call stop server before starting."); } // Looks like StartServer has been called before but failed to start listening. // Lets dispose of the current instance and try again. if (_dicomServer != null) { DisposeDicomServer(); } var fileStoreParameters = new DicomFileStoreParameters(DicomDataReceiverUpdate, getAcceptedTransferSyntaxes, _dicomSaver); // Preload dictionary to prevent timeouts DicomDictionary.EnsureDefaultDictionariesLoaded(); // Constructing the listener dicom server will attempt to start the service. _dicomServer = DicomServer.Create <ListenerDicomService>(ipAddress: "localhost", port: port, userState: fileStoreParameters); // Wait until listening or we have an exception. SpinWait.SpinUntil(() => _dicomServer.IsListening || _dicomServer.Exception != null, timeout); if (_dicomServer.Exception != null) { // Throw any exceptions throw _dicomServer.Exception; } return(_dicomServer?.IsListening ?? false); }
static void Main(string[] args) { try { var server = DicomServer.Create <CStoreSCPProvider>(104); var server2 = DicomServer.Create <QRService>(105); //PacsNodeReader reader = new PacsNodeReader(); //foreach (var item in reader.PacsNode()) //{ // Console.WriteLine($"{item.Name}, {item.Port}"); //} Console.WriteLine("Running..."); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
public bool CreateServer(int port, string serverAET, string fileSaveDir = "") { if (IsListening()) { return(true); } AETitle = serverAET; if (!string.IsNullOrEmpty(fileSaveDir)) { DcmDirPath = fileSaveDir; // 如果文件夹不存在就创建 if (!System.IO.Directory.Exists(fileSaveDir)) { System.IO.Directory.CreateDirectory(fileSaveDir); } } defaultServer = DicomServer.Create <StoreService>(port); return(IsListening()); }
public void Start() { _server = DicomServer.Create <SimpleCStoreProvider>(12345); }
public MyDicomServer(int port, Logger logger) { _logger = logger; _dicomServer = DicomServer.Create <CStoreSCPProvider>(port, null, null, null, logger); }
public override SMIDataChunk DoGetChunk(ICacheFetchRequest cacheRequest, IDataLoadEventListener listener, GracefulCancellationToken cancellationToken) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, $"PACSSource version is {typeof(PACSSource).Assembly.GetName().Version}. Assembly is {typeof(PACSSource).Assembly} ")); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, $"Fo-Dicom version is {typeof(DicomClient).Assembly.GetName().Version}. Assembly is {typeof(DicomClient).Assembly} ")); var dicomConfiguration = GetConfiguration(); var requestSender = new DicomRequestSender(dicomConfiguration, listener); var dateFrom = Request.Start; var dateTo = Request.End; CachingSCP.LocalAet = LocalAETitle; CachingSCP.Listener = listener; if (PatientIdWhitelistColumnInfo != null && !IgnoreWhiteList) { GetWhitelist(listener); } //temp dir var cacheDir = new LoadDirectory(Request.CacheProgress.LoadProgress.LoadMetadata.LocationOfFlatFiles).Cache; var cacheLayout = new SMICacheLayout(cacheDir, new SMICachePathResolver(Modality)); Chunk = new SMIDataChunk(Request) { FetchDate = dateFrom, Modality = Modality, Layout = cacheLayout }; ConcurrentBag <StudyToFetch> studiesToOrder = new ConcurrentBag <StudyToFetch>(); CachingSCP.OnEndProcessingCStoreRequest = (storeRequest, storeResponse) => { SaveSopInstance(storeRequest, cacheLayout, listener); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Stored sopInstance" + storeRequest.SOPInstanceUID.UID)); }; //helps with tyding up resources if we abort or through an exception and neatly avoids -> Access to disposed closure using (var server = (DicomServer <CachingSCP>)DicomServer.Create <CachingSCP>(dicomConfiguration.LocalAetUri.Port)) { DicomClient client = new DicomClient(dicomConfiguration.RemoteAetUri.Host, dicomConfiguration.RemoteAetUri.Port, false, dicomConfiguration.LocalAetTitle, dicomConfiguration.RemoteAetTitle); try { // Find a list of studies #region Query listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Requesting Studies from " + dateFrom + " to " + dateTo)); var request = CreateStudyRequestByDateRangeForModality(dateFrom, dateTo, Modality); request.OnResponseReceived += (req, response) => { if (Filter(_whitelist, response)) { studiesToOrder.Add(new StudyToFetch(response.Dataset.GetSingleValue <string>(DicomTag.StudyInstanceUID))); } }; requestSender.ThrottleRequest(request, client, cancellationToken.AbortToken); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Total filtered studies for " + dateFrom + " to " + dateTo + "is " + studiesToOrder.Count)); #endregion //go and get them #region Retrieval var transferStopwatch = new Stopwatch(); StudyToFetch current; int consecutiveFailures = 0; //While we have things to fetch while (studiesToOrder.TryTake(out current)) { transferStopwatch.Restart(); //delay value in mills if (dicomConfiguration.TransferCooldownInMilliseconds != 0) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Transfers sleeping for " + dicomConfiguration.TransferCooldownInMilliseconds / 1000 + "seconds")); Task.Delay(dicomConfiguration.TransferCooldownInMilliseconds, cancellationToken.AbortToken).Wait(cancellationToken.AbortToken); } bool done = false; //Build fetch command that Study var cMoveRequest = CreateCMoveByStudyUid(LocalAETitle, current.StudyUid, listener); //Register callbacks cMoveRequest.OnResponseReceived += (requ, response) => { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, $"Got {response.Status.State} response for {requ}. Items remaining {response.Remaining}")); switch (response.Status.State) { case DicomState.Pending: case DicomState.Warning: // ignore break; case DicomState.Cancel: case DicomState.Failure: consecutiveFailures++; if (current.RetryCount < MaxRetries) { // put it back in the bag with a increased retry count current.RetryCount++; studiesToOrder.Add(current); } // final state done = true; break; case DicomState.Success: // final state consecutiveFailures = 0; done = true; break; } }; //send the command to the server //tell user what we are sending listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, CMoveRequestToString(cMoveRequest, current.RetryCount + 1))); //do not use requestSender.ThrottleRequest(cMoveRequest, cancellationToken); //TODO is there any need to throtttle this request given its lifetime requestSender.ThrottleRequest(cMoveRequest, client, cancellationToken.AbortToken); //enforce a minimum timeout var swStudyTransfer = Stopwatch.StartNew(); bool hasTransferTimedOut = false; do { Task.Delay(Math.Max(100, dicomConfiguration.TransferPollingInMilliseconds), cancellationToken.AbortToken) .Wait(cancellationToken.AbortToken); hasTransferTimedOut = swStudyTransfer.ElapsedMilliseconds > dicomConfiguration.TransferTimeOutInMilliseconds; }while(!done && !hasTransferTimedOut); // Study has finished being fetched (or timed out) if (hasTransferTimedOut) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Abandonning fetch of study " + current.StudyUid)); } if (consecutiveFailures > 5) { throw new Exception("Too many consecutive failures, giving up"); } // 1 failure = study not available, 2 failures = system is having a bad day? if (consecutiveFailures > 1) { //wait 4 minutes then 6 minutes then 8 minutes, eventually server will start responding again? int sleepFor = consecutiveFailures * 2 * 60_000; listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, $"Sleeping for {sleepFor}ms due to {consecutiveFailures} consecutive failures")); Task.Delay(sleepFor, cancellationToken.AbortToken) .Wait(cancellationToken.AbortToken); } } #endregion } finally { server.Stop(); } } return(Chunk); }
private void MainForm_Load(object sender, EventArgs e) { //LogManager.SetImplementation(NLogManager.Instance); var server = DicomServer.Create <CStoreSCP>(SSCPConfig.Instance.Port); }
public static IDicomServer CreateCFindServer(int port, Logger logger) { return(DicomServer.Create <CFindSCPProvider>(port, null, null, null, logger)); }
public static void Start() { isRunning = true; LogManager.SetImplementation(ConsoleLogManager.Instance); server = DicomServer.Create <DicomCStoreProvider>(port); }
public static void Start(int port, string aet) { AETitle = aet; _server = DicomServer.Create <WorklistService>(port); CreateItemsSourceService.Start(_server.Logger); }
public override SMIDataChunk DoGetChunk(ICacheFetchRequest cacheRequest, IDataLoadEventListener listener, GracefulCancellationToken cancellationToken) { #region assigns var dicomConfiguration = GetConfiguration(); var requestSender = new DicomRequestSender(dicomConfiguration, listener); var dateFrom = Request.Start; var dateTo = Request.End; var hasTransferTimedOut = false; CachingSCP.LocalAet = LocalAETitle; CachingSCP.Listener = listener; if (PatientIdWhitelistColumnInfo != null && !IgnoreWhiteList) { GetWhitelist(listener); } //temp dir var cacheDir = new LoadDirectory(Request.CacheProgress.LoadProgress.LoadMetadata.LocationOfFlatFiles).Cache; var cacheLayout = new SMICacheLayout(cacheDir, new SMICachePathResolver(Modality)); Chunk = new SMIDataChunk(Request) { FetchDate = dateFrom, Modality = Modality, Layout = cacheLayout }; // IOrder order = new ItemsBasedOrder(dateFrom, dateTo, PlacementMode.PlaceThenFill,OrderLevel, listener); IOrder order = new HierarchyBasedOrder(dateFrom, dateTo, PlacementMode.PlaceThenFill, OrderLevel, listener); IPicker picker = null; var pickerFilled = false; var transferTimeOutTimer = new Timer(dicomConfiguration.TransferTimeOutInMilliseconds); transferTimeOutTimer.Elapsed += (source, eventArgs) => { hasTransferTimedOut = true; listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Transfer Timeout Exception Generated")); throw new TimeoutException("Transfer Timeout Exception"); }; CachingSCP.OnEndProcessingCStoreRequest = (storeRequest, storeResponse) => { var item = new Item(storeRequest); transferTimeOutTimer.Reset(); if (picker != null) { picker.Fill(item); pickerFilled = picker.IsFilled(); } SaveSopInstance(storeRequest, cacheLayout, listener); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Stored sopInstance" + storeRequest.SOPInstanceUID.UID)); }; #endregion //helps with tyding up resources if we abort or through an exception and neatly avoids -> Access to disposed closure using (var server = (DicomServer <CachingSCP>)DicomServer.Create <CachingSCP>(dicomConfiguration.LocalAetUri.Port)) { try { // Find a list of studies #region Query listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Requesting Studies from " + dateFrom + " to " + dateTo)); var studyUids = new List <string>(); var request = CreateStudyRequestByDateRangeForModality(dateFrom, dateTo, Modality); request.OnResponseReceived += (req, response) => { if (Filter(_whitelist, response)) { studyUids.Add(response.Dataset.GetSingleValue <string>(DicomTag.StudyInstanceUID)); } }; requestSender.ThrottleRequest(request, cancellationToken); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Total filtered studies for " + dateFrom + " to " + dateTo + "is " + studyUids.Count)); foreach (var studyUid in studyUids) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Sending series query for study" + studyUid)); var seriesUids = new List <string>(); request = CreateSeriesRequestByStudyUid(studyUid); request.OnResponseReceived += (req, response) => { if (response.Dataset == null) { return; } var seriesInstanceUID = response.Dataset.GetSingleValue <string>(DicomTag.SeriesInstanceUID); if (seriesInstanceUID != null) { seriesUids.Add(seriesInstanceUID); } }; requestSender.ThrottleRequest(request, cancellationToken); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Total series for " + studyUid + "is " + seriesUids.Count)); foreach (var seriesUid in seriesUids) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Sending image query for series" + seriesUid)); request = CreateSopRequestBySeriesUid(seriesUid); int imageCount = 0; request.OnResponseReceived += (req, response) => { if (response.Dataset == null) { return; } var sopUid = response.Dataset.GetSingleValue <string>(DicomTag.SOPInstanceUID); var patientId = response.Dataset.GetSingleValue <string>(DicomTag.PatientID); if (sopUid != null && patientId != null) { //Place order order.Place(patientId, studyUid, seriesUid, sopUid); imageCount++; } }; requestSender.ThrottleRequest(request, cancellationToken); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Successfully finished image query for " + seriesUid + " Toal images in series = " + imageCount)); } listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Successfully finished series query for " + studyUid)); } listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Successfully finished query phase")); #endregion //go and get them #region Retrieval var transferStopwatch = new Stopwatch(); //start building request to fill orders //get the picker - the for loop avoids sleeping after all the transfers have finished and attempting dequeue on empty queue for (int delay = 0, transferTimerPollingPeriods; order.HasNextPicker() && !hasTransferTimedOut; delay = (int)(dicomConfiguration.TransferDelayFactor * transferTimerPollingPeriods * dicomConfiguration.TransferPollingInMilliseconds) + dicomConfiguration.TransferCooldownInMilliseconds ) { transferStopwatch.Restart(); //delay value in mills if (delay != 0) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Transfers sleeping for " + delay / 1000 + "seconds")); Task.Delay(delay, cancellationToken.AbortToken).Wait(cancellationToken.AbortToken); } //set this here prior to request pickerFilled = false; transferTimerPollingPeriods = 0; //get next picker picker = order.NextPicker(); // A CMove will be performed if the storescp exists and this storescp is known to the QRSCP: var cMoveRequest = picker.GetDicomCMoveRequest(LocalAETitle); /* this won't work which means we cannot enforce (low) priority * cMoveRequest.Priority=DicomPriority.Low;*/ cMoveRequest.OnResponseReceived += (requ, response) => { if (response.Status.State == DicomState.Pending) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Request: " + requ.ToString() + "items remaining: " + response.Remaining)); } else if (response.Status.State == DicomState.Success) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Request: " + requ.ToString() + "completed successfully")); } else if (response.Status.State == DicomState.Failure) { listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Debug, "Request: " + requ.ToString() + "failed to download: " + response.Failures)); } }; listener.OnProgress(this, new ProgressEventArgs(CMoveRequestToString(cMoveRequest), new ProgressMeasurement(picker.Filled(), ProgressType.Records, picker.Total()), transferStopwatch.Elapsed)); //do not use requestSender.ThrottleRequest(cMoveRequest, cancellationToken); //TODO is there any need to throtttle this request given its lifetime DicomClient client = new DicomClient(); requestSender.ThrottleRequest(cMoveRequest, client, cancellationToken); transferTimeOutTimer.Reset(); while (!pickerFilled && !hasTransferTimedOut) { Task.Delay(dicomConfiguration.TransferPollingInMilliseconds, cancellationToken.AbortToken) .Wait(cancellationToken.AbortToken); transferTimerPollingPeriods++; } transferTimeOutTimer.Stop(); client.Release(); listener.OnProgress(this, new ProgressEventArgs(CMoveRequestToString(cMoveRequest), new ProgressMeasurement(picker.Filled(), ProgressType.Records, picker.Total()), transferStopwatch.Elapsed)); } #endregion } finally { server.Stop(); } } return(Chunk); }
public void StartOwnPacs() { _ourPacs = DicomServer.Create <QRService>(11112); }
private void cargarServicio() { try { string path = ""; try { path = ConfigurationManager.AppSettings["ConfigDirectory"] != null ? ConfigurationManager.AppSettings["ConfigDirectory"].ToString() : ""; } catch (Exception ePath) { path = ""; Log.EscribeLog("Error al obtener el path desde appSettings: " + ePath.Message); } string PathDestino = ""; try { PathDestino = ConfigurationManager.AppSettings["PathDes"].ToString(); //Verificar Folder if (!Directory.Exists(PathDestino)) { Directory.CreateDirectory(PathDestino); } } catch (Exception ePATHDES) { Log.EscribeLog("Existe un error al leer el path de destino: " + ePATHDES.Message); } ClienteF2CResponse mdl = new ClienteF2CResponse(); if (File.Exists(path + "info.xml")) { _conf = XMLConfigurator.getXMLfile(); id_Servicio = _conf.id_Sitio; AETitle = _conf.vchAETitle; vchPathRep = _conf.vchPathLocal; vchClaveSitio = _conf.vchClaveSitio; if (id_Servicio > 0 && vchClaveSitio != "") { Token = Security.Encrypt(id_Servicio + "|" + vchClaveSitio); } } Log.EscribeLog("Sitio: " + vchClaveSitio); if (vchClaveSitio != "") { mdl = ConfigDataAccess.getConeccion(vchClaveSitio, id_Servicio); if (mdl != null || _conf != null) { if (!(id_Servicio > 0)) { id_Servicio = mdl.id_Sitio; } if (vchClaveSitio == "") { vchClaveSitio = mdl.ConfigSitio.vchClaveSitio; } if (AETitle == "") { AETitle = mdl.ConfigSitio.vchAETitle; } if (Token != "") { Token = Security.Encrypt(id_Servicio + "|" + vchClaveSitio); } Log.EscribeLog("Inicio de CargarServicio SCP"); // preload dictionary to prevent timeouts var dict = DicomDictionary.Default; int port = 0; Log.EscribeLog("Puerto: " + (mdl.ConfigSitio == null ? _conf.intPuertoCliente : mdl.ConfigSitio.intPuertoCliente)); Log.EscribeLog("AETitle: " + AETitle); // start DICOM server on port from command line argument or 11112 try { if (_conf.intPuertoCliente > 0) { port = _conf.intPuertoCliente; } else { if (mdl.ConfigSitio.intPuertoCliente > 0) { port = (int)mdl.ConfigSitio.intPuertoCliente; } else { port = Convert.ToInt32(ConfigurationManager.AppSettings["Puerto"].ToString()); } } } catch (Exception ePuerto) { Console.WriteLine("No se pudo leer el puerto especificado, favor de verificar.: " + ePuerto.Message); Log.EscribeLog("No se pudo leer el puerto especificado, favor de verificar.: " + ePuerto.Message); } if (port > 0) { Console.WriteLine($"Iniciando Servidor C-Store SCP en el puerto {port}"); var server = DicomServer.Create <CStoreSCP>(port); Log.EscribeLog($"Iniciando Servidor C-Store SCP en el puerto {port}"); ConfigDataAccess.setService(id_Servicio, vchClaveSitio); // end process Console.WriteLine("Oprimir <return> para finalizar..."); Console.ReadLine(); } else { Console.WriteLine("No se pudo leer el puerto especificado, favor de verificar."); Log.EscribeLog("No se pudo leer el puerto especificado, favor de verificar."); } } } else { Console.WriteLine("No se pudo encontrar los datos para la búsqueda de sitio. En espera de los datos de configuración."); Log.EscribeLog("No se pudo encontrar los datos para la búsqueda de sitio. En espera de los datos de configuración."); } } catch (Exception eLoadService) { Log.EscribeLog("Error al cargar el servicio: " + eLoadService.Message); } }
public static void Start(int port, string aet) { AETitle = aet; _server = DicomServer.Create <QRService>(port); }
private static void StartDicomServer() { Configuration.StationName = "EL_STATIONE"; var m_server = DicomServer.Create <CFindSCP>(worklistport); }
public static void Start(int port, string aet) { Printer = new Printer(aet); _server = DicomServer.Create <PrintService>(port); }
public static void Start(int port) { _server = DicomServer.Create <PrintService>(port); }