Index
Name

PRequest

Description The PRequest object represents an active network request. They are returned by the methods in the PClient used to initiate network requests. A request object can be in one of the states specified by the constant values below. As the state of the request changes, library events are fired to notify the sketch.
Fields
STATE_OPENED   Constant value representing that the request is being sent to the server, waiting for reply

STATE_CONNECTED   Constant value representing that the request has been received and a response is available.

STATE_FETCHING   Constant value representing that the response is being fetched from the server.

STATE_DONE   Constant value representing that the entire response has been read.

STATE_ERROR   Constant value representing that an error occurred and the connection has been closed.

STATE_CLOSED   Constant value representing that connection has been closed and resources have been released.

EVENT_CONNECTED   Event fired when the server has received the request and a response is available.

EVENT_DONE   Event fired when the entire response has been read and is available.

EVENT_ERROR   Event fired when an error has occurred.

state   The current state of the connection, as specified by the above constants

Methods
read()   Reads the next byte of data and returns it as an int.

readChar()   Reads the next byte of data and returns it as a char.

readBytes()   Reads the rest of the response from the server.

close()   Closes the connection and releases the resources associated with this request to the server.

Related PClient