LDicomNet::Close

#include "ltdic.h"

L_VOID LDicomNet::Close(L_VOID)

Closes the connection between an associated SCU and SCP. This function is available in the PACS Imaging Toolkit.

Returns

None.

Comments

Calling this function generates a call to the LDicomNet::OnClose function. The LDicomNet::OnClose function is useful to both SCUs and SCPs.

Calling LDicomNet::Close closes the connection between an associated client and server. The Network connection itself is not shutdown until LDicomNet::ShutDown is called.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

Platforms

Win32, x64

See Also

Functions:

LDicomNet::Accept, LDicomNet::Connect, LDicomNet::OnClose

Topics:

Working with DICOM Network Connections

Example

This function is called by the server to close the connection from the most recently connect client.

LMyDicomNet is a class derived from LDicomNet

In this example, assume

1. m_pDicomNet points to a valid object

2. A connection exists between client and server

3. An associate request has been sent and accepted

L_INT LDicomNet_CloseExample(LMyDicomNet *m_pDicomNet)
{
   L_INT       nRet;
   CString     strMsg;
   LDicomNet * pDicomNetClient;
   L_UINT32    lClientCount;
   L_TCHAR     szClientAddress[100];
   L_UINT      lClientPort;
   //get the latest client, and close the connection
   lClientCount = m_pDicomNet->GetClientCount();
   if (lClientCount > 0)
   {
      pDicomNetClient = m_pDicomNet->GetClient(lClientCount - 1);
      nRet =pDicomNetClient->GetPeerInfo(szClientAddress, 100,  &lClientPort);
      if(nRet > 0)
         return nRet;
      strMsg.Format(TEXT("Total Clients[%d]\nClosing Client [%s]"), lClientCount, szClientAddress);
      AfxMessageBox(strMsg);
      pDicomNetClient->Close();
   }
   else
   {
      AfxMessageBox(TEXT("No Active Clients"));
   }
   return DICOM_SUCCESS;
}