tcp.connection

data type

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


Purpose

The tcp.connection data type represents 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.

Usage Notes

The OmniMark TCP/IP dynamic link library file ("omtcp.dll" or "omtcp.so") creates the tcp.connection data type. The related module definition file ("omtcp.xmd") defines the interface to that type.

The tcp.connection data type is not copyable. This means that when you set the value of one tcp.connection variable to the value of another tcp.connection 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 tcp.connection variable or its copy.

Example

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

     import "omtcp.xmd" prefixed by tcp.
     
     global tcp.connection Connection-1
     global tcp.connection Connection-2
     
     process
        local tcp.connection Connection-3
        local tcp.connection Connection-4

Once you have declared your tcp.connection variables, you can use those variables to create TCP connections to remote machines using the tcp.connect function in the OmniMark TCP/IP library.

     import "omtcp.xmd" prefixed by tcp.
     
     process
        local tcp.connection Connection-1
        
        set Connection-1 to tcp.connect to "banzai.com" on "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 tcp.connection functions.