# Running IRC session.

## Functions

int | irc_run (irc_session_t *session)
| Goes into forever-loop, processing IRC events and generating callbacks.
int | irc_add_select_descriptors (irc_session_t *session, fd_set *in_set, fd_set *out_set, int *maxfd)
| Adds IRC socket(s) for the descriptor set to use in select().
int | irc_process_select_descriptors (irc_session_t *session, fd_set *in_set, fd_set *out_set)
| Processes the IRC socket(s), which descriptor(s) are set.

## Function Documentation

int irc_add_select_descriptors | ( | irc_session_t * | session,
|  | fd_set * | in_set,
|  | fd_set * | out_set,
|  | int * | maxfd |
| ) |  |  |

Adds IRC socket(s) for the descriptor set to use in select().

Parameters:

  | session | An initiated and connected session.
  | in_set | A FD_IN descriptor set for select()
  | out_set | A FD_OUT descriptor set for select()
  | maxfd | A max descriptor found.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno().

This function should be used when you already have a program with select() based data processing. You prepare your descriptors, call this function to add session's descriptor(s) into set, and then call select(). When it returns, you should call irc_add_select_descriptors, which sends/recvs all available data, parses received data, calls your callbacks(!), and returns. Then you can process your sockets from set. See the example.

See also:
  irc_process_select_descriptors

int irc_process_select_descriptors | ( | irc_session_t * | session,
|  | fd_set * | in_set,
|  | fd_set * | out_set |
| ) |  |  |

Processes the IRC socket(s), which descriptor(s) are set.

Parameters:

  | session | An initiated and connected session.
  | in_set | A FD_IN descriptor set for select()
  | out_set | A FD_OUT descriptor set for select()

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno().

This function should be used in pair with irc_add_select_descriptors function. See irc_add_select_descriptors description.

See also:
  irc_add_select_descriptors

int irc_run | ( | irc_session_t * | session | ) |

Goes into forever-loop, processing IRC events and generating callbacks.

Parameters:

  | session | An initiated and connected session.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno().

This function goes into forever loop, processing the IRC events, and calling appropriate callbacks. This function will not return until the server connection is terminated - either by server, or by calling irc_cmd_quit. This function should be used, if you don't need asynchronous request processing (i.e. your bot just reacts on the events, and doesn't generate it asynchronously). Even in last case, you still can call irc_run, and start the asynchronous thread in event_connect handler. See examples.