|
|||||
TCPService
|
The TCPService OMX component allows you to write a server program that accepts TCP connections from remote client machines using the TCP (Transmission Control) protocol. Once the connection is made, you can communicate with the client machine.
The OmniMark TCP dynamic link library file ("omtcp.dll" or "omtcp.so") creates the TCPService OMX component. The related include file ("omtcp.xin") defines the interface to that component. To use TCPService components in your program, you must include the following declaration and include statement in your program:
include "omtcp.xin"
Within your program, you can create as many instances of the TCPService OMX component as you require by declaring global and local variables of type "TCPService". For example:
include "omtcp.xin" global TCPService my-tcpservice-1 global TCPService my-tcpservice-2 process local TCPService my-tcpservice-3 local TCPService my-tcpservice-4
Once you have declared your TCPService OMX variables, you can use those variables to create a TCP service on your machine. For example:
include "omtcp.xin" process local TCPService my-tcpservice set my-tcpservice to TCPServiceOpen 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.
The TCPService OMX component is not copyable. This means that when you set the value of one TCPConnection OMX variable to the value of another TCPService 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 TCPService OMX variable or its copy.