# 22. Virtuoso Functions Guide - ses_read_line

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
dav add & update fun...
dav manipulation fun...
dav search functions
dav_exp
lfs_exp
serv_queue_top
vhost_define
vhost_remove
webdav users & group...
client_attr
connection_get
connection_id
connection_is_dirty
connection_set
connection_vars
connection_vars_set
dbname
ftp_get
ftp_ls
ftp_put
get_certificate_info
get_keyword
get_keyword_ucase
http
http_acl_get
http_body_read
http_client
http_client_ip
http_debug_log
http_enable_gz
http_file
http_flush
http_get
http_header
http_header_get
http_kill
http_listen_host
http_map_get
http_map_table
http_param
http_path
http_pending_req
http_physical_path
http_proxy
http_request_get
http_request_header
http_request_status
http_rewrite
http_root
http_url
http_value
http_xslt
ses_connect
ses_disconnect
ses_read_line
ses_write
tcpip_gethostbyaddr
tcpip_gethostbyname
vsp_calculate_digest
wsdl_import_udt
XML
XPATH & XQUERY
Functions Index

## ses_read_line

Read a line of character data from a TCP session.
varchar ses_read_line ([in ses any], [in throw_exception_on_eof integer], [in binary_modeinteger ]);
Description

This function is used to read a line of character data from an open TCP session. This function will read characters until it reaches an end of line up to a maximum of 1024 characters. The session can be passed as a session_handle. If the session_handle is omitted then execution is in current session/VSP context and will read from the open HTTP session. Ses_read_line() will suspend execution while attempting to read from the session until the timeout period of 100 seconds expires. When the timeout expires an error will be produced to indicate that the operation was unsuccessful.

Parameters
ses – Optional session handle. If none is supplied the current TCP client session is assumed. If this is NULL then the function will read from the string session to be sent to the client upon request completion.
throw_exception_on_eof – Controls whether to throw an error if there is a problem reading from the session or simply return null in text mode or what ever content has has been read so far in binary mode. If this parameter is set to 1, then an error will be thrown. If this parameter is set to 0 then either null or remaining content will be returned as above.
binary_mode – Instructs the function to be in binary or text mode.

- Binary mode: the function reads a maximum of 1024 bytes and returns as much as it read as a varchar.
- Text mode: the function reads up to 0x0A, it will trim all the [0x0A|0x0D] characters at the end of the string and return it as varchar.

Return Types

The characters read from the session are returned from this function.

Examples
Simple demonstration of reading from the HTTP session

This example reads the first line of the session and outputs the contents. This code can be run from a vsp file.

    <p>Some text</p>
    <?vsp
        declare xx any;
        xx := ses_read_line (NULL);

        http (sprintf ('length is %d, "%s"', length (xx), xx));
    ?>

See Also

ses_connect()

ses_disconnect()

ses_write()