#include "ltdic.h"
L_LTDIC_API L_INT EXT_FUNCTION L_DicomSetSocketOptions(hNet, pOptions)
Sets the socket options used in an hNet network handle.
A DICOM Network handle. This is the handle returned from the L_DicomCreateNet function
Pointer to a structure that contains the options to used when creating a socket for DICOM communication.
| Value | Meaning |
|---|---|
| DICOM_SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
This function is used to set options in the socket that will be created when calling the L_DicomConnect function on an hNet network handle. Internally, the socket is created when calling the L_DicomConnect function. Therefore, the L_DicomSetSocketOptions function should be called before calling the L_DicomConnect function.
For more information about sockets, see the MSDN Winsock documentation.
Required DLLs and Libraries
Win32, x64, Linux.
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 DicomSetSocketOptionsExample(L_VOID){L_INT nRet = DICOM_SUCCESS;L_UINT iHostPort = 0;L_UINT iPeerPort = 104;L_TCHAR szHostIP[200] = {0};L_TCHAR szPeerIP[200] = {0};HDICOMNET hNet = 0;// start the networknRet = L_DicomStartUp();if (nRet != DICOM_SUCCESS)return nRet;// set the temporary file pathhNet = L_DicomCreateNet(MAKE_IMAGE_PATH(TEXT("")), DICOM_SECURE_NONE);lstrcpy(szHostIP, TEXT("")); // empty string means use local IPlstrcpy(szPeerIP, TEXT("207.238.49.195")); // valid IP address of computer to connect to// Set the socket options before calling ConnectDICOMSOCKETOPTIONS socketOptions = {0};socketOptions.uStructSize = sizeof(DICOMSOCKETOPTIONS);nRet = L_DicomGetDefaultSocketOptions(hNet, &socketOptions, sizeof(DICOMSOCKETOPTIONS));if (nRet != DICOM_SUCCESS)return nRet;// Display the default socket optionsDisplaySocketOptions(&socketOptions);socketOptions.nSendBufferSize = socketOptions.nSendBufferSize * 2;socketOptions.bNoDelay = !socketOptions.bNoDelay;nRet = L_DicomSetSocketOptions(hNet, &socketOptions);if (nRet != DICOM_SUCCESS)return nRet;// Display the new socket optionsDICOMSOCKETOPTIONS newSocketOptions = {0};newSocketOptions.uStructSize = sizeof(DICOMSOCKETOPTIONS);nRet = L_DicomGetSocketOptions(hNet, &newSocketOptions, sizeof(DICOMSOCKETOPTIONS));DisplaySocketOptions(&newSocketOptions);// connect to a servernRet = L_DicomConnect(hNet, szHostIP, iHostPort, szPeerIP, iPeerPort);if (nRet != DICOM_SUCCESS)return nRet;// ...// ...// ...L_DicomClose(hNet);L_DicomFreeNet(hNet);return nRet;}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
