Skip to main content

Creating Custom TCP Adapter Classes

Creating Custom TCP Adapter Classes

To create a custom subclass of a TCP adapter class, do the following in an IDE:

  1. On the File menu, click New, and then click the General tab.

  2. Start the New Class Wizard by clicking InterSystems IRIS Class Definition and clicking OK.

    1. Enter a package and class name and click Next.

      Important:

      Be sure to avoid reserved package names; see Reserved Package Names.

    2. Click Extends for the Class type.

    3. Click Browse next to Name of super class and navigate to the class that you want to subclass.

    4. Click OK.

    5. Click Finish.

    The result is a template class like the following, depending on the class you chose:

    Class MyTest.NewClass1 Extends EnsLib.TCP.InboundAdapter
    {
    
    }
  3. You can override any property, method, class parameter, or other class member inherited from the class or its parent classes, or you can add new class members. The only requirements are as follows:

    • An inbound adapter class must implement the OnConnected() method.

      In your implementation, use helper methods inherited by your class.

    • An outbound adapter class define methods that create a TCP connection, read or write over the connection, and disconnect.

      To define these methods, use helper methods inherited by your class.

  4. Compile the class, which also saves it.

FeedbackOpens in a new tab