swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
    Related Concepts   Other Library Functions  
function   TCPConnectionGetSource    

Library: omtcp - TCP/IP client and server support
Include: omtcp.xin
Return type: Opaque
Returns:       

An external source object.


Declaration

  define external source function TCPConnectionGetSource
        value TCPConnection this-TCPConnection
        timeout value integer timeout-in-milliseconds optional
        protocol value IOProtocol this-IOProtocol optional
  as TCPConnectionGetSource


Purpose

This function returns an external source object from which data will be read.

If the passed TCP connection object is closed or was never connected, then this function returns a dummy external source object that immediately returns "end of input". At the same time, it sets the TCP connection object to be in error.

The timeout value applies primarily to data read from the returned external source.

TCPConnectionGetSource can be called more than once for a connection. All such derived sources read from the same source attachment, but such sources are subject to read-ahead, and it is generally the case that a read from a source will actually capture more data than is needed for immediate use. This means that if there are two or more sources derived from a connection, it is usually the case that data read from one such source is not that which immediately follows that read from another such source. As a consequence, only ONE external source can be derived from a connection at a time. That is, sources must be derived serially.

If a TCP connection from which an external source is derived is closed using TCPConnectionClose, then it is in error to perform a read from the source. The TCP connection object is made to be in error, and the source returns "end of input", as it does for other errors.

Arguments:

Example:

  local TCPConnection TCP-Conn
  local stream s

  set TCP-Conn to TCPConnectionOpen on "localhost" at 5300
  TCPConnectionSetBuffering TCP-Conn enabled false

  open s with binary-mode as
     TCPConnectionGetOutput TCP-Conn
        protocol IOProtocolMultiPacket

  put s "hello world"
  close s

  output TCPConnectionGetSource TCP-Conn
        protocol IOProtocolMultiPacket

      Related Concepts
   Security considerations
 
Other Library Functions
   TCPConnectionClose
   TCPConnectionGetCharacters
   TCPConnectionGetLine
   TCPConnectionGetOutput
   TCPConnectionGetPeerIP
   TCPConnectionGetPeerName
   TCPConnectionGetSource
   TCPConnectionGetStatusReport
   TCPConnectionHasCharactersToRead
   TCPConnectionIsConnected
   TCPConnectionIsInError
   TCPConnectionOpen
   TCPConnectionPut
   TCPConnectionSetBuffering
   TCPConnectionSignalSourceEnd
   TCPIsVersionCompatible
   TCPLibraryVersion
   TCPServiceAcceptConnection
   TCPServiceClose
   TCPServiceGetPort
   TCPServiceGetStatusReport
   TCPServiceIsInError
   TCPServiceIsOpen
   TCPServiceOpen
   TCPTraceConnectionOpen
 
----  

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ OMX ] [ OMX ] [ ERRORS ]

Generated: August 11, 2000 at 3:08:03 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.