#include "ltdic.h"
L_INT LDicomNet::SetSocketOptions(pOptions)
pDICOMSOCKETOPTIONS pOptions; |
pointer to a structure |
Sets the socket options used in a LDicomNet object. This feature is available in version 16 or higher.
Parameter |
Description |
pOptions |
Pointer to a structure that contains the options to used when creating a socket for DICOM communication. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
This method is used to set options in the socket that will be created when calling LDicomNet::Connect on a LDicomNet object. Internally, the socket is created when calling LDicomNet::Connect. Therefore, LDicomNet::SetSocketOptions method should be called before calling LDicomNet::Connect.
For more information about sockets, see the MSDN Winsock documentation.
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. |
Win32, x64
Functions: |
LDicomNet::GetDefaultSocketOptions, LDicomNet::GetSocketOptions, Class Members |
Topics: |
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_VOID DisplaySocketOptions(pDICOMSOCKETOPTIONS pOptions)
{
L_TCHAR szMsg[200] = {0};
if (!pOptions)
return;
wsprintf(szMsg, TEXT("Socket Options:\n\tnSendBufferSize: %d\n\tnReceiveBufferSize: %d\n\tbNoDelay: %d"),
pOptions->nSendBufferSize,
pOptions->nReceiveBufferSize,
pOptions->bNoDelay);
MessageBox(NULL, szMsg, TEXT("Socket Options"), MB_OK);
}
L_INT LDicomNet_SetSocketOptionsExample()
{
L_INT nRet = DICOM_SUCCESS;
L_INT iHostPort = 0; //Use first available port
L_INT iPeerPort = 104;
L_TCHAR * pszHostIP = TEXT(""); //empty string means use local IP
L_TCHAR * pszPeerIP = TEXT("207.238.49.190"); //Put a valid IP addres of a computer to connect to
// LMyDicomNet is a class derived from LDicomNet
//set the temporary file path
LDicomNet *pDicomNet = new LDicomNet(MAKE_IMAGE_PATH(TEXT("temp")), DICOM_SECURE_NONE);
if (pDicomNet == NULL)
return DICOM_ERROR_MEMORY;
//startup the network
nRet = pDicomNet->StartUp();
if (nRet != DICOM_SUCCESS)
return nRet;
// Set the socket options before calling Connect
DICOMSOCKETOPTIONS socketOptions = {0};
socketOptions.uStructSize = sizeof(DICOMSOCKETOPTIONS);
nRet = pDicomNet->GetDefaultSocketOptions(&socketOptions, sizeof(DICOMSOCKETOPTIONS));
if (nRet != DICOM_SUCCESS)
return nRet;
// Display the default socket options
DisplaySocketOptions(&socketOptions);
socketOptions.nSendBufferSize = socketOptions.nSendBufferSize * 2;
socketOptions.bNoDelay = !socketOptions.bNoDelay;
nRet = pDicomNet->SetSocketOptions(&socketOptions);
if (nRet != DICOM_SUCCESS)
return nRet;
// Display the new socket options
DICOMSOCKETOPTIONS newSocketOptions = {0};
newSocketOptions.uStructSize = sizeof(DICOMSOCKETOPTIONS);
nRet = pDicomNet->GetSocketOptions(&newSocketOptions, sizeof(DICOMSOCKETOPTIONS));
DisplaySocketOptions(&newSocketOptions);
//connect to a server using the new socket options
nRet = pDicomNet->Connect(pszHostIP, iHostPort, pszPeerIP, iPeerPort);
if (nRet != DICOM_SUCCESS)
return nRet;
// ...
// ...
// ...
pDicomNet->Close();
delete pDicomNet;
return DICOM_SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET