TCPConnection

data type

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


Purpose

The TCPConnection OMX component allows you to create a connection to a remote machine using the TCP/IP (Transmission Control/Internet) protocol. Once the connection is made, you can communicate with the remote machine.

The OmniMark TCP/IP dynamic link library file ("omtcp.dll" or "omtcp.so") creates the TCPConnection OMX component. The related include file ("omtcp.xin") defines the interface to that component. To use TCPConnection 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 TCPConnection OMX component as you require by declaring global and local variables of type "TCPConnection". For example:

     include "omtcp.xin"
     
     global TCPConnection my-tcpcon-1
     global TCPConnection my-tcpcon-2
     
     process
        local TCPConnection my-tcpcon-3
        local TCPConnection my-tcpcon-4

Once you have declared your TCPConnection OMX variables, you can use those variables to create TCP connections to remote machines using the TCPConnectionOpen function in the original TCP/IP library. For example:

     include "omtcp.xin"
     
     process
        local TCPConnection my-tcpcon
        
        set my-tcpcon to TCPConnectionOpen on "banzai.com"
                                           at "5600"

Assuming no errors occur when establishing the connection to the remote machine, you can now communicate with that machine via the TCP protocol using the other TCPConnection functions.

The TCPConnection OMX component is not copyable. This means that when you set the value of one TCPConnection OMX variable to the value of another TCPConnection OMX variable, you end up with two variables pointing at the same external object. You are able to manipulate both variables, but those manipulations are being performed on the same TCP connection, whether you use the original TCPConnection OMX variable or its copy.