#include "ltdic.h"
L_INT LDicomNet::SetSocketOptions(pOptions)
Sets the socket options used in a LDicomNet object. This feature is available in version 16 or higher.
Pointer to a structure that contains the options to used when creating a socket for DICOM communication.
Value | Meaning |
---|---|
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 LDicomNet::Connect on a LDicomNet object. Internally, the socket is created when calling LDicomNet::Connect. Therefore, LDicomNet::SetSocketOptions function should be called before calling LDicomNet::Connect.
For more information about sockets, see the MSDN Winsock documentation.
Required DLLs and Libraries
Win32, x64
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 address 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;
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.