tcp-service

data type

Library: TCP/IP client and server support (OMTCP legacy, OmniMark versions 6.0.2 - 7.0)
Include: omtcp.xin


Purpose

The tcp-service OMX component represents a service assigned to listen at a specific location (port) for TCP connection requests from client machines.

Usage Notes

The tcp-service OMX component is not copyable. This means that when you set the value of one tcp-service OMX variable to the value of another tcp-service OMX variable, you end up with two variables pointing at the same OMX component. You are able to get information about the TCP service through both variables, but that information is coming from the same external object whether you use the original tcp-service OMX variable or its copy.

Once the connection is made (represented by a tcp connection object), you can communicate with the client machine.

To use tcp-service objects in your program, you must include the following include statement in your program:

     include "omtcp.xin"

Example

Within your program, you can create as many instances of the tcp-service OMX component as you require by declaring global and local variables of type "tcp-service".

     include "omtcp.xin"
  
     global tcp-service Service-1
     global tcp-service Service-2
  
     process
        local tcp-service Service-3
        local tcp-service Service-4

Once you have declared your tcp-service OMX variables, you can use those variables to create a TCP service on your machine. For example:

     include "omtcp.xin"
  
     process
        local tcp-service Service
  
        set Service to tcp-create-service at 5600

Assuming that no errors occur when setting up the service, remote machines are now able to create a TCP connection with your system on the port you specified.