tcp.disconnect

function

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

Declaration
define external function tcp.disconnect
 value tcp.connection Connection

Argument definitions

Connection
is a tcp.connection object.


Purpose

Use tcp.disconnect to explicitly close a connection.

Usage Notes

You can use tcp.disconnect to destroy a connection that has never been created or has already been destroyed.

Once a connection is closed then any read or write operation on an external source or output derived from it is in error.

Allowing the tcp.connection variable to go out of scope has the same effect as using tcp.disconnect.

It is good programming practice to have the scope of external sources and outputs derived from a TCP connection match that of the TCP connection itself. If this is done, then the programmer doesn't have to worry about the effect of the derived sources and outputs on the lifetime of the connection.

Example


  import "omtcp.xmd" prefixed by tcp.
  
  process
     local tcp.connection Client
  
     set Client to tcp.connect to "123.123.123.45" on 5600
  	. . .
     tcp.disconnect Client