tcp.service

data type

Library: TCP/IP client and server support (OMTCP)
Import : omtcp.xmd


Purpose

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

Usage Notes

The tcp.service data type is not copyable. This means that when you set the value of one tcp.service variable to the value of another tcp.service variable, you end up with two variables pointing at the same object. 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 variable or its copy.

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

Example

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

     import "omtcp.xmd" prefixed by tcp.
  
     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 variables, you can use those variables to create a TCP service on your machine. For example:

     import "omtcp.xmd" prefixed by tcp.
  
     process
        local tcp.service Service
  
        set Service to tcp.create-service on 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.