|
|||||
|
||||||
Other Library Functions |
function |
tcp-get |
Library: TCP/IP client and server support (OMTCP legacy, OmniMark versions 6.0.2 - 7.0)
Include: omtcp.xin |
Return type: String Returns: |
define external stream function tcp-get value tcp-connection Connection size value integer MinRead optional variable-to value integer MaxRead optional timeout value integer ms optional
Argument definitions
Use tcp-get to return characters received from a source on the TCP connection object.
You must include the following line at the beginning of your OmniMark program:
include "omtcp.xin"
Connection must represent an existing connection (else external exception TCP05).
There must not be an active external source derived from Connection with tcp-source (else external exception TCP04).
If MinRead is specified, it must have a value of -1 or greater (else external exception TCP03).
If MaxRead is specified, it must have a value of -1 or greater (else external exception TCP03).
If both MinRead and MaxRead are specified, MinRead must have a value less than the value of MaxRead (else external exception TCP03).
If an error occurs during the read, external exception TCP11 is thrown.
If the read operation times out, external exception TCP07 is thrown.
If neither MinRead nor MaxRead is specified the function reads as many characters as are available, as long as there is at least one character.
Specifying value of -1 for either MinRead or MaxRead indicates no limit. (This is the default value for both parameters.)
Sequential uses of tcp-get and tcp-source are allowed. It is also guaranteed that tcp-get will only ever read the characters it returns from a source. Any following characters are available to the next tcp-get or tcp-source.
local tcp-connection Connection-1 set Connection-1 to tcp-connect on "localhost" at 5300 output tcp-get Connection-1
output tcp-get tcp-connect on "localhost" at 5300 size 10
Copyright © Stilo International plc, 1988-2010.