Return code of dcmsnd is zero when errors occur

306 views
Skip to first unread message

Andreas Borg

unread,
Oct 31, 2013, 10:49:21 AM10/31/13
to dcm...@googlegroups.com
Hello,

we use dcmsnd in a shell script and check the return code (aka exit status / exit code) to see if an error occured (in which case the images will be sent again), with code like this:
 
dcmsnd ..
if [ "$?" -ne "0" ]; then
  # error handling code goes here
fi


For very critical errors (i.e. no network connection) this works as expected. However, in some cases, dcmsnd returns a zero status even if something goes wrong, for example, if some, but not all images were transferred successfully. Another example this case (sensitive information removed):

Scanned 1 files in 0.079s (=79ms/file)
09:23:01,371 INFO   - Association(1) initiated Socket[addr=/[removed],port=4095,localport=54501]
09:23:01,373 INFO   - STORESCP(1): A-ASSOCIATE-RQ STORESCP << DCMSND
09:23:01,392 INFO   - STORESCP(1): A-ASSOCIATE-AC DCMSND >> STORESCP
Connected to STORESCP@[removed]:4095 in 0.082s
09:23:01,459 INFO   - STORESCP(1) << 1:C-STORE-RQ[pcid=3, prior=0
        cuid=1.2.840.10008.5.1.4.1.1.4/MR Image Storage
        iuid=1.3.46.670589.11.10002.5.0.4176.2013100709172900275
        ts=1.2.840.10008.1.2.4.70/JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])]
09:23:01,949 INFO   - STORESCP(1) >> 1:C-STORE-RSP[pcid=3, status=110H
        error=Connection refused]
ERROR: Received RSP with Status 0110H for [name removed].dcm, cuid=1.2.840.10008.5.1.4.1.1.4, tsuid=1.2.840.10008.1.2.4.70
(0000,0100) US #2 [32769] Command Field
(0000,0120) US #2 [1] Message ID Being Responded To
(0000,0800) US #2 [257] Command Data Set Type
(0000,0900) US #2 [272] Status
(0000,0902) LO #18 [Connection refused] Error Comment

F
Sent 0 objects (=0.0KB) in 0.591s (=0.0KB/s)
09:23:01,983 INFO   - STORESCP(1) << A-RELEASE-RQ
09:23:02,002 INFO   - STORESCP(1) >> A-RELEASE-RP
Released connection to STORESCP@[removed]
09:23:02,002 INFO   - STORESCP(1): close Socket[addr=/[removed],port=4095,localport=54501]

In this case, the script believes the transmission was successful and continues. Is this a bug or intended behaviour?

Best regards,

Andreas
 

fleetwoodfc

unread,
Nov 1, 2013, 5:56:32 AM11/1/13
to dcm...@googlegroups.com
This is intended behaviour. dcmsnd will exit with code not 0 only if it fails to establish a connection with the Store SCP, otherwise it prints out info for each request/response transaction - even if the response is an error code. 
Reply all
Reply to author
Forward
0 new messages