LDicomNet::Listen

#include "ltdic.h"

L_INT LDicomNet::Listen(pszHostAddress, nHostPort, nNbPeers)

L_TCHAR * pszHostAddress;

/* host IP address */

L_UINT nHostPort;

/* host port number */

L_INT nNbPeers;

/* maximum number of peers */

Establishes a connection to listen for incoming connection requests. This function is available in the PACS Imaging Toolkit.

Parameter

Description

pszHostAddress

Character string that contains the IP address of the host computer (the SCP's address).

nHostPort

Port number of the host (the SCP's port).

nNbPeers

The maximum number of (SCUs) that may be connected to the SCP.

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

If pszHostAddress is "" or NULL, the IP address will be the local computer's address.

If nHostPort is 0, the port number will be the number of the first available port.

To connect to a server as a client, you must first create and initialize a DICOM Network object using LDicomNet::LDicomNet . Then call LDicomNet::Connect to establish the connection.

To use your computer as an SCP, you must first create a DICOM Network object using LDicomNet::LDicomNet. Then call LDicomNet::Listen to listen for incoming connection requests.

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::LDicomNet, LDicomNet::StartUp, LDicomNet::Listen

Topics:

Working with DICOM Network Connections

Example

L_INT LDicomNet_ListenExample(LMyDicomNet *m_pDicomNet)
{
   L_INT nRet;
   //LMyDicomNet is a class derived from LDicomNet
   //m_pDicomNet is a member variable declared as:
   //set the temporary file path
   m_pDicomNet = new LMyDicomNet(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\temp"), DICOM_SECURE_NONE);
   L_TCHAR *strHostIP = TEXT("");
   L_INT iPeerPort = 104;
   //startup the network
   nRet = m_pDicomNet->StartUp();
   //create a server to accept up to 25 clients
   nRet = m_pDicomNet->Listen(strHostIP, iPeerPort, 25);
   if(nRet != DICOM_SUCCESS)
      return nRet;
   return DICOM_SUCCESS;
}