int vortex_connection_get_next_channel ( VortexConnection connection)

Returns the next channel number free to be used over this session.

This function iterates over the allowed channel number range, that is: 1..2147483647 including both limits, stepping over channel number 0, which always exists during the connection live.

Channel numbers assigned automatically depends on the connection role. In the case the connection role is "initiator", next channel number returned will be odd-numbered. In the case the connection role is "listener", next channel number will be even-numbered.

Parameters
connectionthe connection where the channel is going to be created
Returns
the channel number to use or -1 if fail.

References MAX_CHANNELS_NO, vortex_connection_channel_exists(), vortex_connection_get_role(), vortex_mutex_lock(), vortex_mutex_unlock(), and VortexRoleInitiator.