nip2pWaitForStreamEvent

int32_t nip2pWaitForStreamEvent (nip2p_tStreamHandle streamHandle, nip2p_tStreamEvent event, int32_t timeoutMsec);

Purpose

Blocks until either the specified stream event occurs or until the specified timeout has expired.

Parameters

Input
Name Type Description
StreamHandle nip2p_tStreamHandle Identifies the stream to monitor for events.
event nip2p_tStreamEvent Specifies the event this function waits to occur.

Value Meaning
nip2p_kStreamEventFIFOOverflow (0) Occurs when the writer tries to write data to the stream and the stream is full or in the Disabled state.
nip2p_kStreamEventFIFOUnderflow (1) Occurs when the reader tries to read data from the stream and the stream is empty or in the Disabled state.
nip2p_kStreamEventStreamEnabled (2) Occurs when the peer-to-peer host, reader, or writer enables a stream.
nip2p_kStreamEventStreamDisabled (3) Occurs when the peer-to-peer host, reader, or writer disables a stream.
timeoutMsec int32_t Specifies the maximum amout of time to wait, in milliseconds, for the stream event. If this parameter is set to -1, the operation waits indefinitely for the event. If the operation times out, the kNIP2PStatusOperationTimedOut error message is returned.

Return Value

Name Type Description
Error code int32_t Returns the error code for the session or execution thread.

Value Meaning
0 No error.
Positive Values Warning, but the operation succeeded.
Negative Values An error occurred and the operation did not succeed.