Association Steps

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
freddy311082
Posts: 8
Joined: Tue, 2006-06-06, 03:55

Association Steps

#1 Post by freddy311082 »

Hi to everybody

I'm trying to implement the communication with another DICOM's AET. When I'm trying to make the association, I need to put the Presentation Context to the T_ASC_Parameters instance and the others parameters... How can I do that ???

Best regards

Freddy

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

Re: Association Steps

#2 Post by J. Riesmeier »

I would recommend that you check whether you could use the DcmSCU class. It's basically a wrapper around the SCU functionality of the dcmnet module.

freddy311082
Posts: 8
Joined: Tue, 2006-06-06, 03:55

Re: Association Steps

#3 Post by freddy311082 »

Code: Select all

Ok, but I need tu do my own implementation and right now I'm testing the solutions that I can do... Here is my code to to make an ECHO-SCU:

OFCondition DcmNetService ::cecho()
{
    // Checking the network status
    OFCondition cond = ASC_initializeNetwork(NET_ACCEPTORREQUESTOR, 0, 30, &this->network);

    if(cond.good())
    {
        printf("The NETWORK is ready to be used.\n");
        // Negociating the association.
        if (this->association == NULL)
            //return DIMSE_ILLEGALASSOCIATION;
            return EC_CorruptedData;
        const char* tsEcho[] = { UID_LittleEndianImplicitTransferSyntax };
        ASC_setAPTitles(this->asscParameter, this->calling_AET.c_str(), this->called_AET.c_str(), 0);
        ASC_addPresentationContext(this->asscParameter,1, UID_VerificationSOPClass, tsEcho, 1);
        cond = ASC_requestAssociation(this->network, this->asscParameter, &this->association);

        if (cond.good())
        {
            char * sopClass = strdup(UID_VerificationSOPClass);
            T_ASC_PresentationContextID idPC = ASC_findAcceptedPresentationContextID(this->association, sopClass);
            bzero((char*)this->req, sizeof(this->req));
            bzero((char*)this->resp, sizeof(this->resp));

            this->req->CommandField = DIMSE_C_ECHO_RQ;
            this->req->msg.CEchoRQ.MessageID = this->association->nextMsgID++;
            strcpy(this->req->msg.CEchoRQ.AffectedSOPClassUID,sopClass);
            this->req->msg.CEchoRQ.DataSetType = DIMSE_DATASET_NULL;

            cond = DIMSE_sendMessageUsingMemoryData(this->association, idPC, this->req, 0,0,0,0);

            if (cond.bad())
            {
                printf("Error sending C-ECHO-RQ message. Status = %s", cond.text());
                this->closeAssociation();
                return cond;
            }
            DcmDataset * status = NULL;
            cond = DIMSE_receiveCommand(this->association, DIMSE_BLOCKING,0, &idPC, this->resp, &status);
            if (cond.bad())
            {
                printf("Error receiving C-ECHO-RSP message. Status = %s", cond.text());
                this->closeAssociation();
                return cond;
            }

            if (this->resp->msg.CEchoRSP.MessageIDBeingRespondedTo != this->resp->msg.CEchoRQ.MessageID)
            {
                printf("Error receiving C-ECHO-RSP message. The Message ID received is not correct. Status = %s", cond.text());
                this->closeAssociation();
                return cond;
            }
        }
    }

    else
        printf("error");

    this->closeAssociation();

    return cond;
}

and I have the following error:

Code: Select all

DUL Illegal parameter (maxPDU) in function DUL_RequestAssociation
How can I fix this ???

best regards

Post Reply

Who is online

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