Click or drag to resize

ClientChannel Class

Bi-directional TCP/IP communication channel with an OBCOM NetServer.
Inheritance Hierarchy
SystemObject
  OBCOM.NetClientClientChannel

Namespace:  OBCOM.NetClient
Assembly:  OBCOM.NetClient (in OBCOM.NetClient.dll) Version: 40.82.5945.17884 (40.82.5945.17884)
Syntax
public sealed class ClientChannel : IDisposable

The ClientChannel type exposes the following members.

Properties
  NameDescription
Public propertyAlive
Returns true if the ClientChannel is alive.
Public propertyAlwaysEncrypt
Indicates whether messages are always sent encrypted to OBCOM NetServer.
Public propertyClientListener
Returns the ClientListener of the ClientChannel.
Public propertyLayoutManager
Returns the LayoutManager of the ClientChannel.
Public propertyName
Returns the name of the ClientChannel.
Public propertyNetServerURI
Returns the NetServer URI (protocol, host and port) of the ClientChannel.
Public propertyStationKey
Returns the station key of the ClientChannel.
Public propertyVersion
Returns the implementation version of the ClientChannel.
Top
Methods
  NameDescription
Public methodStatic memberCreate(String, String, LayoutManager)
Creates and returns a new ClientChannel with supplied arguments.
Public methodStatic memberCreate(String, String, String)
Creates and returns a new ClientChannel instance.
Public methodStatic memberCreate(String, String, LayoutManager, ClientListener)
Creates a new ClientChannel with supplied arguments.
Public methodStatic memberCreate(String, String, String, ClientListener)
Creates and returns a new ClientChannel with supplied arguments.
Public methodStatic memberDelete
Deletes the ClientChannel with the specified channelName.
Public methodDispose
Dispose (free, release and reset) managed and unmanaged objects.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberExists
Returns true if a ClientChannel with the specified channelName is defined.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLayout
Returns the Layout with the supplied layoutName.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberlookup
Returns the ClientChannel with the specified channelName.
Public methodNewSlot
Creates and returns a new ClientSlot of this ClientChannel.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

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"));
    }
}
See Also