ClientChannel Class |
Namespace: OBCOM.NetClient
The ClientChannel type exposes the following members.
Name | Description | |
---|---|---|
![]() | Alive |
Returns true if the ClientChannel is alive.
|
![]() | AlwaysEncrypt |
Indicates whether messages are always sent encrypted to OBCOM NetServer.
|
![]() | ClientListener |
Returns the ClientListener of the ClientChannel.
|
![]() | LayoutManager |
Returns the LayoutManager of the ClientChannel.
|
![]() | Name |
Returns the name of the ClientChannel.
|
![]() | NetServerURI |
Returns the NetServer URI (protocol, host and port) of the ClientChannel.
|
![]() | StationKey |
Returns the station key of the ClientChannel.
|
![]() | Version |
Returns the implementation version of the ClientChannel.
|
Name | Description | |
---|---|---|
![]() ![]() | Create(String, String, LayoutManager) |
Creates and returns a new ClientChannel with supplied arguments.
|
![]() ![]() | Create(String, String, String) |
Creates and returns a new ClientChannel instance.
|
![]() ![]() | Create(String, String, LayoutManager, ClientListener) |
Creates a new ClientChannel with supplied arguments.
|
![]() ![]() | Create(String, String, String, ClientListener) |
Creates and returns a new ClientChannel with supplied arguments.
|
![]() ![]() | Delete |
Deletes the ClientChannel with the specified channelName.
|
![]() | Dispose |
Dispose (free, release and reset) managed and unmanaged objects.
|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() ![]() | Exists |
Returns true if a ClientChannel with the specified channelName is defined.
|
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLayout |
Returns the Layout with the supplied layoutName.
|
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | lookup |
Returns the ClientChannel with the specified channelName.
|
![]() | NewSlot |
Creates and returns a new ClientSlot of this ClientChannel.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
An application use a ClientChannel to send transactions, receive unsolicited data, and request other services from the NetServer or other custom made servers (see ServerChannel for details about building custom servers).
The communication channel is established as late as possible. Yet, once established, it is kept running until a system operator executes the "kill client" command in an NetServer Console. If the communication channel is lost for any other reason, it is automatically re-established as soon as possible.
In order to maximize reusability and to reduce the number of physical network connections, the ClientChannel communication link is implemented as a shared (multiplexed) channel. For this reason, a client application cannot use a ClientChannel directly, but it has to acquire a ClientSlot instance using the NewSlot method. It is through this ClientSlot that the client application communicates with the NetServer environment.
The following example uses a ClientChannel named SampleClient to obtain the date from a server called ACASER. This is accomplished by sending a transaction named ACA-TIME to the ACASER server. If an error occurs while processing this transaction, the reply code of the reply message will not be ACK. In this case, an exception is thrown with a message obtained from the Data of the reply message. If successful, the ClientSlot is released and the server's date is retrieved from a field called ACC_FECHA of the reply message and displayed in the system console.
using OBCOM.NetClient; public class SampleClient { public static void Main(string[] args) { // Create an OBCOM NetServer client named "CCLIENT" LayoutManager layouts = new LayoutManager("http://host/layouts/*.aspx"); ClientChannel channel = ClientChannel.Create("CCLIENT", "net://host:10104", layouts); // Send transaction to "ACASER" server using a channel slot Message reply; using (ClientSlot slot = channel.NewSlot()) { reply = slot.SendTransaction("ACASER.ACA-TIME", null); } if (reply.ReplyCode != Message.Reply.ACK) throw new NetException(reply.Data); // Display the date contained in the "ACASER" reply message. System.Console.WriteLine("The reply date is " + reply.GetDate("ACC_FECHA")); } }