swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      Other Library Functions  
function  

TCPConnectionGetSource

 
 

Library: TCP/IP client and server support (OMTCP) original
Include: omtcp.xin
Return type: String source

Returns: An external source object.


Declaration

define external string 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

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

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.