←Select platform

SocketOptions Property

Summary
Gets or sets the DICOM Socket options.
Syntax
C#
VB
C++
public DicomSocketOptions SocketOptions { get; set; } 
Public Property SocketOptions As DicomSocketOptions 
public: 
property DicomSocketOptions SocketOptions { 
   DicomSocketOptions get(); 
   void set (    DicomSocketOptions value); 
} 

Property Value

The DICOM socket options to use when calling DicomNet.Connect().

Remarks

This property contains the socket options that will be used when calling DicomNet.Connect(). Internally, the socket is created when calling DicomNet.Connect(). Therefore, if you do not want to use the default socket options, you must set the SocketOptions before calling DicomNet.Connect().

Example

This example will change the socket options before calling DicomNet.Connect

C#
VB
using Leadtools; 
using Leadtools.Dicom; 
 
 
void DisplaySocketOptions(DicomSocketOptions options) 
{ 
   string sMsg = string.Format("Socket Options:\n\tnSendBufferSize: {0}\n\tnReceiveBufferSize: {1}\n\tbNoDelay: {2}", 
      options.SendBufferSize, 
      options.ReceiveBufferSize, 
      options.NoDelay); 
 
   Console.WriteLine($"Socket Options: {sMsg}"); 
} 
 
public void SocketOptionsSample() 
{ 
   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   using (DicomNet net = new DicomNet(Path.Combine(LEAD_VARS.ImagesDir, "temp"), DicomNetSecurityMode.None)) 
   { 
      DicomSocketOptions options = net.DefaultSocketOptions; 
 
      // Display the default socket options 
      DisplaySocketOptions(options); 
 
      // Set the socket options before calling Connect 
      options.SendBufferSize = options.SendBufferSize * 2; 
      net.SocketOptions = options; 
 
      // Display the new socket options 
      DisplaySocketOptions(net.SocketOptions); 
 
      //connect to a server using the new socket options 
      net.Connect(null, 1000, "127.0.0.1", 104); 
 
      // ... 
      // ... 
      // ... 
 
      net.Close(); 
   } 
 
   DicomEngine.Shutdown(); 
   DicomNet.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Dicom 
 
Private Sub DisplaySocketOptions(ByVal options As DicomSocketOptions) 
   Dim sMsg As String = String.Format("Socket Options:" & Constants.vbLf + Constants.vbTab & "nSendBufferSize: {0}" & Constants.vbLf + Constants.vbTab & 
                                      "nReceiveBufferSize: {1}" & Constants.vbLf + Constants.vbTab & "bNoDelay: {2}", options.SendBufferSize, 
                                      options.ReceiveBufferSize, options.NoDelay) 
 
   MessageBox.Show(sMsg, "Socket Options", MessageBoxButtons.OK) 
End Sub 
 
Public Sub SocketOptionsSample() 
   DicomEngine.Startup() 
   DicomNet.Startup() 
 
   Dim net As DicomNet = New DicomNet(Path.Combine(LEAD_VARS.ImagesDir, "temp"), DicomNetSecurityMode.None) 
   Try 
      Dim options As DicomSocketOptions = net.DefaultSocketOptions 
 
      ' Display the default socket options 
      DisplaySocketOptions(options) 
 
      ' Set the socket options before calling Connect 
      options.SendBufferSize = options.SendBufferSize * 2 
      net.SocketOptions = options 
 
      ' Display the new socket options 
      DisplaySocketOptions(net.SocketOptions) 
 
      'connect to a server using the new socket options 
      net.Connect(Nothing, 1000, "127.0.0.1", 104) 
 
      ' ... 
      ' ... 
      ' ... 
 
      net.Close() 
   Finally 
      CType(net, IDisposable).Dispose() 
   End Try 
 
   DicomEngine.Shutdown() 
   DicomNet.Shutdown() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

Help Version 21.0.2021.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.