当前位置: 首页 > news >正文

视频网站做游戏分发商融建设集团有限公司网站

视频网站做游戏分发,商融建设集团有限公司网站,浏览器被2345网址导航,私人ftp服务器系列文章目录 文章目录系列文章目录前言一、echoSCU工程流程二、代码前言 第六章 StoreSCU-图像发送 和 第七章 FindSCU-查询工作列表两篇文章中都有“测试连接”的功能, 其实现方式都是利用dcmtk实现echoSCU功能。 本章单独介绍echoSCU的工作流程。参考dcmtk 源码…

系列文章目录


文章目录

  • 系列文章目录
  • 前言
  • 一、echoSCU工程流程
  • 二、代码


前言

第六章 StoreSCU-图像发送 和 第七章 FindSCU-查询工作列表两篇文章中都有“测试连接”的功能,
其实现方式都是利用dcmtk实现echoSCU功能。
本章单独介绍echoSCU的工作流程。参考dcmtk 源码echoscu.cc,源文件路径dcmtk-3.6.9\dcmnet\apps\echoscu.cc


一、echoSCU工程流程

dcmtk中SCU的流程大同小异。
注意与
第六章 storescu.cc中的主要流程

第七章 dcmtk findscu主要流程
对比。
前面1~8步的网络协商流程都一样,只有第8步以后处理不同

  1. ASC_initializeNetwork初始化网络
  2. ASC_createAssociationParameters
  3. ASC_setAPTitles
  4. ASC_setTransportLayerType
  5. ASC_setPresentationAddresses
  6. ASC_addPresentationContext
  7. ASC_requestAssociation
  8. ASC_countAcceptedPresentationContexts判断连接是否成功,不成功返回,成功则调用echoSCU测试连接
  9. echoSCU中调用DIMSE_echoUser真正发送连接测试,检测返回是否连接成功
  10. 测试连接完成,释放连接,关闭网络

二、代码

BOOL CWlFindSCU::Echo()
{T_ASC_Network *net;T_ASC_Parameters *params;DIC_NODENAME localHost;DIC_NODENAME peerHost;T_ASC_Association *assoc;OFString temp_str;/* initialize network, i.e. create an instance of T_ASC_Network*. */OFCondition cond = ASC_initializeNetwork(NET_REQUESTOR, 0, 30, &net);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Init network failed: \n%s"), temp_str.c_str());return FALSE;}/* initialize asscociation parameters, i.e. create an instance of T_ASC_Parameters*. */cond = ASC_createAssociationParameters(&params, ASC_DEFAULTMAXPDU);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Create Association Parameters Failed: %s"), temp_str.c_str());return FALSE;}/* sets this application's title and the called application's title in the params *//* structure. The default values to be set here are "STORESCU" and "ANY-SCP". */ASC_setAPTitles(params, m_param.localAET.c_str(), m_param.remoteAET.c_str(), NULL);/* Set the transport layer type (type of network connection) in the params *//* strucutre. The default is an insecure connection; where OpenSSL is  *//* available the user is able to request an encrypted,secure connection. */cond = ASC_setTransportLayerType(params, OFFalse);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Set Transport Layer Type Failed: %s"), temp_str.c_str());return FALSE;}/* Figure out the presentation addresses and copy the *//* corresponding values into the association parameters.*/gethostname(localHost, sizeof(localHost) - 1);sprintf_s(peerHost, "%s:%d", m_param.serverIP.c_str(), m_param.port);ASC_setPresentationAddresses(params, localHost, peerHost);/* Set the presentation contexts which will be negotiated *//* when the network connection will be established */int presentationContextID = 1; /* odd byte value 1, 3, 5, .. 255 */for (unsigned long ii = 0; ii < 1; ii++){cond = ASC_addPresentationContext(params, presentationContextID, UID_VerificationSOPClass,EchotransferSyntaxes, 1);presentationContextID += 2;if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Add Presentation Context Failed: %s"), temp_str.c_str());return FALSE;}}/* dump presentation contexts if required *///OFLOG_DEBUG(echoscuLogger, "Request Parameters:" << OFendl << ASC_dumpParameters(temp_str, params, ASC_ASSOC_RQ));ASC_dumpParameters(temp_str, params, ASC_ASSOC_RQ);Replace(temp_str, _T("\n"), _T("\r\n"));log_debug(_T("Request Parameters:\r\n%s"), temp_str.c_str());/* create association, i.e. try to establish a network connection to another *//* DICOM application. This call creates an instance of T_ASC_Association*. */cond = ASC_requestAssociation(net, params, &assoc);if (cond.bad()){if (cond == DUL_ASSOCIATIONREJECTED){T_ASC_RejectParameters rej;ASC_getRejectParameters(params, &rej);ASC_printRejectParameters(temp_str, &rej);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Association Rejected:\r\n%s"), temp_str.c_str());return FALSE;}else{DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Association Request Failed: %s"), temp_str.c_str());return FALSE;}}/* dump the presentation contexts which have been accepted/refused */ASC_dumpParameters(temp_str, params, ASC_ASSOC_AC);Replace(temp_str, _T("\n"), _T("\r\n"));log_debug(_T("Association Parameters Negotiated:\r\n%s"), temp_str.c_str());/* count the presentation contexts which have been accepted by the SCP *//* If there are none, finish the execution */if (ASC_countAcceptedPresentationContexts(params) == 0){log_error(_T("No Acceptable Presentation Contexts"));return FALSE;}/* dump general information concerning the establishment of the network connection if required */log_debug(_T("Association Accepted (Max Send PDV: %d)"), assoc->sendPDVLength);/* do the real work, i.e. send a number of C-ECHO-RQ messages to the DICOM application *//* this application is connected with and handle corresponding C-ECHO-RSP messages. */cond = echoSCU(assoc);BOOL bEchoOK = FALSE;if (cond == EC_Normal)bEchoOK = TRUE;/* tear down association, i.e. terminate network connection to SCP */if (cond == EC_Normal){/* release association */log_info(_T("Releasing Association"));log_info(_T("连接成功."));cond = ASC_releaseAssociation(assoc);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Association Release Failed: %s"), temp_str.c_str());return bEchoOK;}}else if (cond == DUL_PEERREQUESTEDRELEASE){log_error(_T("Protocol Error: Peer requested release (Aborting)"));log_info(_T("连接失败."));cond = ASC_abortAssociation(assoc);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Association Abort Failed: %s"), temp_str.c_str());return bEchoOK;}}else if (cond == DUL_PEERABORTEDASSOCIATION){log_info(_T("Peer Aborted Association"));log_info(_T("连接失败."));}else{DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Find SCU Failed: %s"), temp_str.c_str());log_info(_T("连接失败."));cond = ASC_abortAssociation(assoc);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Association Abort Failed: %s"), temp_str.c_str());return bEchoOK;}}/* destroy the association, i.e. free memory of T_ASC_Association* structure. This *//* call is the counterpart of ASC_requestAssociation(...) which was called above. */cond = ASC_destroyAssociation(&assoc);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("destroy association failed: %s"), temp_str.c_str());return bEchoOK;}/* drop the network, i.e. free memory of T_ASC_Network* structure. This call *//* is the counterpart of ASC_initializeNetwork(...) which was called above. */cond = ASC_dropNetwork(&net);if (cond.bad()){DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Drop Network Failed: %s"), temp_str.c_str());return bEchoOK;}return bEchoOK;
}OFCondition CWlFindSCU::echoSCU(T_ASC_Association * assoc)
{DIC_US msgId = assoc->nextMsgID++;DIC_US status;DcmDataset *statusDetail = NULL;/* dump information if required */log_info(_T("Sending Echo Request (MsgID %d)"), msgId);/* send C-ECHO-RQ and handle response */OFCondition cond = DIMSE_echoUser(assoc, msgId, DIMSE_BLOCKING, 0, &status, &statusDetail);/* depending on if a response was received, dump some information */if (cond.good()){log_info(_T("Received Echo Response (%s)"), DU_cechoStatusString(status));}else{OFString temp_str;DimseCondition::dump(temp_str, cond);Replace(temp_str, _T("\n"), _T("\r\n"));log_error(_T("Echo Failed: "), temp_str.c_str());}/* check for status detail information, there should never be any */if (statusDetail != NULL){std::ostringstream ostr;ostr << DcmObject::PrintHelper(*statusDetail);log_debug(_T("Status Detail (should never be any):\r\n"), ostr.str().c_str());delete statusDetail;}/* return result value */return cond;
}
http://www.dtcms.com/a/595530.html

相关文章:

  • 猎上网登陆官方网站百度免费云服务器
  • 响应式品牌网站设计wordpress标题省略
  • wap网站生成小程序网站不显示内容吗
  • 未来软件网站建设app企业网站模板
  • 网站建设书籍网站正在升级建设中代码
  • 嵌入式软件开发面试哈尔滨百度seo公司
  • 怎么用ps做简单网站首页西安自助建站公司
  • 浦项建设(中国)有限公司网站泉州网站设计师招聘
  • 有没有好的ppt网站做参考的建设网站沙井
  • 周口网站制作哪家好网站建设策划书目录
  • 专业的网站建设商家运维工程师
  • 网站建设 技术 哪些内容网站建设公司ejiew
  • 如何自学建网站wordpress菜单分级
  • 岚山区建设局网站wordpress 标签作用
  • 网站建设录哪个科目台州企业建站系统
  • 网站信息管理系统动漫制作专业主修课程
  • 如何判断网站html5口碑好的东莞网站建设
  • 有没有介绍做私家导游的网站企业做网站需要注意什么
  • 网站 功能呢石碣企业网站建设公司
  • 佛山营销网站建设制作怎么制作ppt 教程
  • 哈尔滨网站专业制作aws wordpress ssl
  • 微网站 .net怎么做浏览器网站
  • 自己做的网站怎么让别人看到wordpress设置安全
  • 韩国网页设计公司网站照片素材库网站免费
  • 涟水县住房和城乡建设局网站博达高校网站群建设教程
  • 深圳开发网站开发费用网络工程师培训班哪里
  • 箱包网站模板基础型网站套餐
  • 专业上海网站建设公司排名郑州软件app开发公司
  • 做传销网站后果严重吗wordpress projects
  • 网站建设wixsap中小企业解决方案