DCMTK server code

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Hafiz Rafeeq
Posts: 8
Joined: Tue, 2017-10-10, 09:44

DCMTK server code

#1 Post by Hafiz Rafeeq »

I tried running a simple sever code

DcmSCP scp;
scp.setAETitle("SERVER");
scp.setPort(11112);
scp.listen();
As far as i know, the builtin listen() function of DCMScp class comes with the capability to handle C-ECHO. But when i try

echoscu -aec "SERVER" -aet "ECHO" 127.0.0.1 11112

i get the following output for echoscu

F: Association Request Failed: 0006:0317 Peer aborted Association (or never connected)


and at scp i get

I: Association Received TA-DT-110: ECHO -> SERVER
I: Incoming Association Request:
I: ====================== BEGIN A-ASSOCIATE-RQ =====================
I: Our Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.2
I: Our Implementation Version Name: OFFIS_DCMTK_362
I: Their Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.2
I: Their Implementation Version Name: OFFIS_DCMTK_362
I: Application Context Name: 1.2.840.10008.3.1.1.1
I: Calling Application Name: ECHO
I: Called Application Name: SERVER
I: Responding Application Name:
I: Our Max PDU Receive Size: 16384
I: Their Max PDU Receive Size: 16384
I: Presentation Contexts:
I: Context ID: 1 (Proposed)
I: Abstract Syntax: =VerificationSOPClass
I: Proposed SCP/SCU Role: Default
I: Proposed Transfer Syntax(es):
I: =LittleEndianImplicit
I: Requested Extended Negotiation: none
I: Accepted Extended Negotiation: none
I: Requested User Identity Negotiation: none
I: User Identity Negotiation Response: none
I: ======================= END A-ASSOCIATE-RQ ======================
E: 0006:042d profile key undefined: DEFAULT

what am i missing here?

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#2 Post by Michael Onken »

Hi,

which version of DCMTK are you using?

Best,
Michael

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#3 Post by J. Riesmeier »

Looking at the Implementation Version Name, I would say DCMTK 3.6.2 :-)

Hafiz Rafeeq
Posts: 8
Joined: Tue, 2017-10-10, 09:44

Re: DCMTK server code

#4 Post by Hafiz Rafeeq »

J. Riesmeier wrote:Looking at the Implementation Version Name, I would say DCMTK 3.6.2 :-)
Yes I am using DCMTK 3.6.2 :)
I think that the default profile is missing profile key.

Hafiz Rafeeq
Posts: 8
Joined: Tue, 2017-10-10, 09:44

Re: DCMTK server code

#5 Post by Hafiz Rafeeq »

adding the following to the code helped solve it.

scp.addPresentationContext(UID_VerificationSOPClass, UID_LittleEndianImplicitTransferSyntax);

And thank you guys for always helping out. :)

Regards
Hafiz

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#6 Post by J. Riesmeier »

I checked the classes: DcmSCP does provide a C-ECHO handler but does not add the Verification SOP Class to the (default) list of accepted Presentation Contexts; this is different from the DcmStorageSCP class, which is derived from DcmSCP and which accepts the Verification SOP Class by default.

Excerpt from the DcmStorageSCP documentation:

Code: Select all

 *    [...] If no association negotiation profile is loaded,
 *    the SCP will only support the Verification SOP Class (with Default Transfer Syntax,
 *    i.e. C-ECHO with Implicit VR Little Endian), which is required for all DICOM
 *    Service Class Providers.

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#7 Post by Michael Onken »

Not sure what the best behavior of DcmSCP would be, but I tend to keep it as is. However, at least the current documentation should be much clearer. I will change it in the next days. Thanks for the hint Hafiz.

Best regards,
Michael

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#8 Post by J. Riesmeier »

Also the error message ("E: 0006:042d profile key undefined: DEFAULT") could be clearer, i.e. when the default profile is empty.

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#9 Post by Michael Onken »

Yes, I'll fix that too.

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: DCMTK server code

#10 Post by Michael Onken »

Dear Hafiz,

here is the follow up:

I extended DcmSCP with an option for allowing to handle Verification SOP class. Also the existing documentation has been extended to explain the default behavior (i.e. not to support Verification at all). See this commit.

Also I added a better error message in case the user forgot to add any presentation contexts, or added invalid ones. In that case, the code now also returns a dedicated error code (new OFCondition consant). See this commit.

Thanks for reporting! :)

Best regards,
Michael

Hafiz Rafeeq
Posts: 8
Joined: Tue, 2017-10-10, 09:44

Re: DCMTK server code

#11 Post by Hafiz Rafeeq »

Dear Michael,

Thanks for updating the library and thanks for the mention. You guys are really doing a great job maintaining such a wonderful tool. Hope this proves useful to people who use this tool in the future. :)

Best Regards
Hafiz

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 1 guest