Loading...
Searching...
No Matches
Qore::SocketPollOperation Class Reference

Socket poll operation object returned by Socket polling methods. More...

`#include <QC_SocketPollOperation.dox.h>`

Inheritance diagram for Qore::SocketPollOperation:
[legend]

## Public Member Functions

| constructor (Socket socket, string goal, *hash< auto > opts)
| Creates the object with the given goal. More...
*hash< SocketPollInfo > | continuePoll ()
| Returns a socket poll hash if polling should continue or NOTHING if complete. More...
| copy ()
| Throws an exception; objects of this class cannot be copied. More...
| destructor ()
| Destroys the object. More...
Public Member Functions inherited from Qore::SocketPollOperationBase
| constructor ()
| Throws an exception; this class is not usable by Qore classes. More...
| destructor ()
| Destroys the object.
string | getGoal ()
| Returns the goal. More...
auto | getOutput ()
| Returns any output generated by any completed poll action. More...
string | getState ()
| Returns the current state. More...
bool | goalReached ()
| Returns True when the goal as been reached. More...
Public Member Functions inherited from Qore::AbstractPollOperation
abstract *hash< SocketPollInfo > | continuePoll ()
| Returns a socket poll hash if polling should continue or NOTHING if complete. More...
abstract string | getGoal ()
| Returns the goal. More...
auto | getOutput ()
| Returns any output generated by any completed poll action. More...
abstract string | getState ()
| Returns the current state. More...
abstract bool | goalReached ()
| Returns True when the goal as been reached. More...

## Detailed Description

Socket poll operation object returned by Socket polling methods.

This class implements the polling logic for Sockets and the state machine behind it

private members:

- Socket sock: the Socket being polled
- string goal: the goal of the poll operation

Since
  Qore 1.12

## Member Function Documentation

## constructor()

Qore::SocketPollOperation::constructor | ( | Socket | socket,
|  | string | goal,
|  | *hash< auto > | opts
| ) |  |

Creates the object with the given goal.

Parameters

  socket | the Socket object to poll

  goal

  the type of goal; currently one of:
  - `connect`
  - `connect-ssl`

  opts

  required keys depend on goal
  - for goal_type `connect` and `connect-ssl`:
    - `url` (string): the URL to connect to

Exceptions

  INVALID-GOAL | thrown if the goal is invalid

## continuePoll()

*hash< SocketPollInfo > Qore::SocketPollOperation::continuePoll | ( |  | ) |

virtual

Returns a socket poll hash if polling should continue or NOTHING if complete.

Returns
  NOTHING if there is no more to poll and the poll operation was successful (i.e. the goal was reached), otherwise this method must return a new socket poll hash to continue the polling operation with another operation, after which this method will be called again if a matching event is received for the socket. If a socket poll hash is returned, then the internal state is also updated.

Implements Qore::AbstractPollOperation.

## copy()

Qore::SocketPollOperation::copy | ( |  | ) |

Throws an exception; objects of this class cannot be copied.

Exceptions

  SOCKETPOLLOPERATION-COPY-ERROR | objects of this class cannot be copied

## destructor()

Qore::SocketPollOperation::destructor | ( |  | ) |

Destroys the object.

Destroys the object