LDicomNet::OnConnect

#include "ltdic.h"

virtual L_VOID LDicomNet::OnConnect(nErro)

L_INT nError;

/* error code */

Notifies the SCU that the connection attempt is complete. This function is available in the Medical Suite Toolkit.

Parameter

Description

nError

Error code. Refer to Return Codes.

Returns

None.

Comments

A call to this function is generated on an SCU when an SCP calls LDicomNet::Accept. It is generated whether or not the connection attempt is successful. It is also generated when a connection attempt has timed-out.

To customize this function, you must derive a class from LDicomNet and override this function.

A DICOM Association must be established between an SCU and an SCP before any DICOM messages or data can be transmitted between them. For more information on creating a DICOM Association, refer to Creating a DICOM Associate Connection.

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

See Also

Functions:

LDicomNet::Connect, LDicomNet::Accept, LDicomNet::OnConnect

Topics:

Creating a DICOM Network Connection

Example

//LMyDicomNet is a class derived from LDicomNet
//In class LMyDicomNet, all events (virtual functions OnXXX())  have been 
//overridden so that they can be processed.  Each event displays a MessageBox 
//identifying the event, the IP that generated the event, the IP that received the event
//any other relevant data

//For the entire derived class, see (hyperlink)LMyDicomNet class

//OnConnect()--client receives this event
L_VOID   LMyDicomNet::OnConnect(L_INT nError)
{
   L_UINT lServerPort, lClientPort;
   L_CHAR  szServerAddress[100], szClientAddress[100];
   CString strMsg;
   CString strTmp;
   
   strMsg.Format("*** OnConnect ***\n");
   if (nError == DICOM_SUCCESS)
   {
      GetHostInfo(szClientAddress, &lClientPort);
      strTmp.Format("ClientAddress[%s]\nClientPort[%d]\n", szClientAddress, lClientPort);
      strMsg = strMsg + strTmp;
      
      GetPeerInfo(szServerAddress, &lServerPort);
      strTmp.Format("ServerAddress[%s]\nServerPort[%d]\n", szServerAddress, lServerPort);
      strMsg = strMsg + strTmp;
   } 
   else
   {
      strTmp.Format("Error[%d]\n",nError);
      strMsg = strMsg + strTmp;
   }
   
   AfxMessageBox(strMsg);
}