Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All


HTTPRead (socket,buffer[,type {Default zero for server; Non-zero for client}]) Returns received-byte-count


Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded, allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

HTTPRead is a client and server command that reads a complete HTTP request message or response. Servers use it to read requests, and clients use it to read responses.

Socket is a long integer field containing the socket number of an open HTTP connection.

Buffer is a character or binary field into which HTTPRead places the received request or response. If the field is character, then the response must be encoded in UTF-8; in this case, HTTPRead converts the received data from UTF-8 to character.

Type is an optional parameter. It is a Boolean value, where zero indicates server behavior, and non-zero indicates client behavior. If omitted, it defaults to zero.

Received-byte-count is a long Integer field which receives the number of bytes placed in Buffer. If an error occurs, an error code less than zero is returned here. Possible error codes are listed in the Web Command Error Codes Appendix.

NoteHTTPRead always operates in blocking mode, and will timeout after the connection is inactive for the comms timeout value (which can be changed from its default of 1 minute using the command WebDevSetConfig). The server reads until the HTTP request header is complete, and it has received content of the correct size. The client behaves similarly, but will also treat graceful closure of the connection as marking the end of the response.


; When a new connection is received call the method $newconnection
; to read the message
HTTPServer ('$newconnection',6001) Returns lStatus
; method $newconnection
HTTPRead (iSocket,lBuffer) Returns lByteCount