Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS DICOM C DLL Help

L_DicomSetSocketOptions

Show in webframe

#include "ltdic.h"

L_LTDIC_API L_INT EXT_FUNCTION L_DicomSetSocketOptions(hNet, pOptions)

HDICOMNET hNet;

/* a DICOM Network handle */

pDICOMSOCKETOPTIONS pOptions;

/* pointer to a structure */

Sets the socket options used in an hNet network handle.

Parameter

Description

hNet

A DICOM Network handle. This is the handle returned from the L_DicomCreateNet function

pOptions

Pointer to a structure that contains the options to used when creating a socket for DICOM communication.

Returns

DICOM_SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

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.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_DicomGetDefaultSocketOptions, L_DicomGetSocketOptions, L_DicomSetSocketOptions

Topics:

Working with DICOM Network Connections

 

DICOM Network Connection: Creating a Network Connection

Example

#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 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 network
   nRet = L_DicomStartUp();
   if (nRet != DICOM_SUCCESS)
      return nRet;
   // set the temporary file path
   hNet = L_DicomCreateNet(MAKE_IMAGE_PATH(TEXT("")), DICOM_SECURE_NONE);
   lstrcpy(szHostIP, TEXT("")); // empty string means use local IP 
   lstrcpy(szPeerIP, TEXT("207.238.49.195")); // valid IP addres of computer to connect to
   // Set the socket options before calling Connect
   DICOMSOCKETOPTIONS socketOptions = {0};
   socketOptions.uStructSize = sizeof(DICOMSOCKETOPTIONS);
   nRet = L_DicomGetDefaultSocketOptions(hNet, &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 = L_DicomSetSocketOptions(hNet, &socketOptions);
   if (nRet != DICOM_SUCCESS)
      return nRet;
   // Display the new socket options
   DICOMSOCKETOPTIONS newSocketOptions = {0};
   newSocketOptions.uStructSize = sizeof(DICOMSOCKETOPTIONS);
   nRet = L_DicomGetSocketOptions(hNet, &newSocketOptions, sizeof(DICOMSOCKETOPTIONS));
   DisplaySocketOptions(&newSocketOptions);
   // connect to a server
   nRet = L_DicomConnect(hNet, szHostIP, iHostPort, szPeerIP, iPeerPort);
   if (nRet != DICOM_SUCCESS)
      return nRet;
   // ...
   // ...
   // ...
   L_DicomClose(hNet);
   L_DicomFreeNet(hNet);
   return nRet;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.