XML Script logo
Command _socket
Attribute

store, a pointer(s) - creative mode

[optional] the element used to store incoming characters.

Attribute

timeout, a number, defaults to '15'

[optional] the timeout, in seconds.

Attribute

port, a number

[optional] the number of the port on the given host.

Attribute

host, a string

[optional] the hostname.

Description

Communicates with a socket on a 'host'. The 'host' and 'port' attributes are required if no connection is already open. If 'host' and 'port' attributes are set, a new connection will be opened, and the given 'timeout' value will be established for that connection. If these attributes are not set, the tag will talk to whichever socket is already open. Within the tag, all content is ignored except <write />, <read_to />, <read_all />, and <close /> subelements. For this reason, this tag (and subsequent communication with the same socket) must be nested within the program logic, and not the other way round. The contents of the <write />, <read_to /> and <read_all /> tags will be evaluated, so it is also possible to nest program logic within these tags. The contents of any <write /> subelements are written to the connection. When a <read_to /> subelement is encountered, all incoming characters are fed into the element defined by the tag's 'store' attribute, up to (but not including) the characters which make up the content of the <read_to /> subelement. Each <read_to /> subelement will store content in a separate <data /> subelement inside the 'store' element. When a <read_all /> tag is encountered, characters are read until the remote host closes the connection (or the timeout is reached). The characters are stored in a <data /> subelement of the 'store'. The <read_to /> and <read_all /> sub-element may have an optional attribute,'ignore', which, if set to a value which does not evaluate to zero, will cause the data read to be discarded instead of being stored. If either read or write operations fail for longer than the 'timeout' value, or if the <close /> subelement is encountered, the socket will be closed.

XML Script homepage | Documentation home | XML Script docs | Command list | Function list | X-Tract docs

X-Stream, X-Tract and XML Script are trade marks of DecisionSoft Limited
© Copyright 1998-2000 DecisionSoft Limited