using System;
namespace NetMQ
{
///
/// This subclass of EventArgs contains a NetMQSocket,
/// and IsReadyToReceive and IsReadyToSend flags to indicate whether ready to receive or send.
///
public class NetMQSocketEventArgs : EventArgs
{
///
/// Create a new NetMQSocketEventArgs referencing the given socket.
///
/// the NetMQSocket that this is in reference to
public NetMQSocketEventArgs(NetMQSocket socket)
{
Socket = socket;
}
///
/// Initialise the ReceiveReady and SendReady flags from the given PollEvents value.
///
/// a PollEvents value that indicates whether the socket is ready to send or receive without blocking
internal void Init(PollEvents events)
{
IsReadyToReceive = events.HasIn();
IsReadyToSend = events.HasOut();
}
///
/// Get the NetMQSocket that this references.
///
public NetMQSocket Socket { get; }
///
/// Get whether at least one message may be received by the socket without blocking.
///
public bool IsReadyToReceive { get; private set; }
///
/// Get whether at least one message may be sent by the socket without blocking.
///
public bool IsReadyToSend { get; private set; }
}
}