Leadtools.Dicom Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SocketOptions Property
See Also  Example
Leadtools.Dicom Namespace > DicomNet Class : SocketOptions Property



Gets or sets the DICOM Socket options.

Syntax

Visual Basic (Declaration) 
Public Property SocketOptions As DicomSocketOptions
Visual Basic (Usage)Copy Code
Dim instance As DicomNet
Dim value As DicomSocketOptions
 
instance.SocketOptions = value
 
value = instance.SocketOptions
C# 
public DicomSocketOptions SocketOptions {get; set;}
C++/CLI 
public:
property DicomSocketOptions SocketOptions {
   DicomSocketOptions get();
   void set (DicomSocketOptions value);
}

Return Value

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

Example

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

Visual BasicCopy Code
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(LeadtoolsExamples.Common.ImagesPath.Path + "temp", DicomNetSecurityeMode.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
C#Copy Code
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); 
   MessageBox.Show(sMsg, "Socket Options", MessageBoxButtons.OK); 

 
public void SocketOptionsSample() 

   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   using (DicomNet net = new DicomNet(LeadtoolsExamples.Common.ImagesPath.Path + "temp",DicomNetSecurityeMode.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(); 
}

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().

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Leadtools.Dicom requires a Medical toolkit server license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features