Closed rpascal closed 5 years ago
I am having the same issue: "System.Net.Sockets.SocketException: 'Only one usage of each socket address (protocol/network address/port) is normally permitted'"
I just tried to pull the studies from one patient and error appears.
// Store the details of the daemon (Ae Title , IP , port ) Entity daemon = new Entity("VMSDBD", "10.XXX.17.XXX", XXXXX); // Store the details of the client (Ae Title , port ) -> IP address is //determined by CreateLocal() method Entity local = Entity.CreateLocal("DCMXX", XXXXX);
// Set up a client ( DICOM SCU = Service Class User )
var client = new DICOMSCU(local);
// Set up a receiver to catch the files as they come in
var receiver = new DICOMSCP(local);
// Let the daemon know we can take anything it sends
receiver.SupportedAbstractSyntaxes = AbstractSyntax.ALL_RADIOTHERAPY_STORAGE;
// Set up storage location
var desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var storagePath = System.IO.Path.Combine(desktopPath, "DICOM_Storage");
Directory.CreateDirectory(storagePath);
// Set the action when a DICOM files comes in
receiver.DIMSEService.CStoreService.CStorePayloadAction = (dcm, asc) =>
{
var path = System.IO.Path.Combine(storagePath, dcm.GetSelector().SOPInstanceUID.Data + ".dcm");
Console.WriteLine($" Writing_file_{ path }... ");
dcm.Write(path);
return true; // Lets daemom know if you successfully wrote to drive
};
receiver.ListenForIncomingAssociations(true);
//// Build a finder class to help with C- FIND operations
var finder = client.GetCFinder(daemon); \\error here `
The script works pretty well with version 2.0.2.9, but it gets the same error with version 2.0.3.1.
I rolled back this change. Please try 2.0.3.2
I am reading DICOM files from a folder and then using CStore to send the DICOM files.
The first store works properly but then on the second store it fails to connect to the TCPClient in
DICOMSCU.SendMessage
, the error thrown isOnly one usage of each socket address (protocol/network address/port) is normally permitted ip:port
I believe that the first client is not being released once the send completes.