DelegatedServer Constructor

Summary
Initializes a new instance of the DelegatedServer class.
Syntax
C#
C++/CLI
Python
public DelegatedServer( 
   string ipAddress, 
   int port, 
   int hostLoad 
) 
public: 
DelegatedServer(  
   String^ ipAddress, 
   int port, 
   int hostLoad 
) 
__init__(self,ipAddress,port,hostLoad) # Overloaded constructor 

Parameters

ipAddress
Identifies the IP address of the host for the JPIP server that is managing the new channel.

port
Identifies the numerical port number to which the JPIP server that is managing the new channel is listening for requests.

hostLoad
When multiple hosts are added to the DelegatedServersCollection, this parameter specifies the load distributed on each server.

Remarks

This constructor creates a new instance of the DelegatedServer class and adds this newly created DelegatedServer to the DelegatedServersCollection collection.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Jpip; 
using Leadtools.Jpip.Client.WinForms; 
using Leadtools.Jpip.Client.InteractiveDecoder; 
using Leadtools.Jpip.Server; 
using Leadtools.Jpip.Logging; 
 
private JpipServer _server; 
private const string LOCAL_IP_ADDRESS = "127.0.0.1"; 
private const int PORT_107 = 107; 
private string IMAGE_NAME = Path.Combine(LEAD_VARS.ImagesDir, "Earth8000_Precint_4_.j2k"); 
private string CACHE_DIRECTORY = Path.Combine(LEAD_VARS.ImagesDir, "jpeg2000"); 
 
public ServerDelegationExample() 
{ 
   _server = new JpipServer(); 
} 
 
public void SetServerDelegation() 
{ 
   Leadtools.Examples.Support.SetLicense(); 
   DelegatedServer delegatedServer1; 
   DelegatedServer delegatedServer2; 
   delegatedServer1 = new DelegatedServer("127.0.0.1", 108, 6); 
   delegatedServer2 = new DelegatedServer("127.0.0.1", 105, 3); 
   _server.Configuration.DelegateServers.Clear(); 
   _server.Configuration.DelegateServers.Add(delegatedServer1); 
   _server.Configuration.DelegateServers.Add(delegatedServer2); 
   Console.WriteLine("Server requests will be delegated to the following {0} servers:", 
                       _server.Configuration.DelegateServers.Count.ToString()); 
 
   foreach (DelegatedServer server in _server.Configuration.DelegateServers) 
   { 
      Console.WriteLine("Server: {0}:{1}", server.IpAddress, server.Port.ToString()); 
   } 
   _server.Start(); 
 
   /* client side */ 
   JpipRasterImageViewer jpipViewer = new JpipRasterImageViewer(); 
   jpipViewer.FileOpened += new EventHandler(jpipViewer_FileOpened); 
   SetViewer(jpipViewer); 
   jpipViewer.Open(IMAGE_NAME); 
} 
 
void jpipViewer_FileOpened(object sender, EventArgs e) 
{ 
   JpipRasterImageViewer jpipViewer = (JpipRasterImageViewer)sender; 
   jpipViewer.ZoomIn(); 
   jpipViewer.Close(); 
   _server.Stop(); 
 
} 
 
public void SetViewer(JpipRasterImageViewer viewer) 
{ 
   viewer.CacheDirectoryName = CACHE_DIRECTORY; 
   viewer.PortNumber = PORT_107; 
   viewer.IPAddress = LOCAL_IP_ADDRESS; 
   viewer.PacketSize = 16384; 
   viewer.ChannelType = JpipChannelTypes.HttpChannel; 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

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