LDicomNet::Listen
#include "ltdic.h"
L_INT LDicomNet::Listen(pszHostAddress, nHostPort, nNbPeers)
L_CHAR * 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 Medical Suite 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: |
|
Topics: |
Example
{
//LMyDicomNet is a class derived from LDicomNet
//m_pDicomNet is a member variable declared as:
// LMyDicomNet *m_pDicomNet;
int nRet;
//set the temporary file path
m_pDicomNet = new LMyDicomNet("d:\\temp", DICOM_SECURE_NONE);
char *strHostIP = "";
int iPeerPort = PEER_PORT;
//startup the network
nRet = m_pDicomNet->StartUp();
//create a server to accept up to 25 clients
m_pDicomNet->Listen(strHostIP, iPeerPort, 25);
}