本文整理汇总了C#中NetMQ.zmq.SocketBase.CheckTag方法的典型用法代码示例。如果您正苦于以下问题:C# SocketBase.CheckTag方法的具体用法?C# SocketBase.CheckTag怎么用?C# SocketBase.CheckTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetMQ.zmq.SocketBase
的用法示例。
在下文中一共展示了SocketBase.CheckTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public static bool Connect(SocketBase s, String addr)
{
if (s == null || !s.CheckTag())
{
throw new InvalidOperationException();
}
return s.Connect(addr);
}
示例2: Close
public static void Close(SocketBase s)
{
if (s == null || !s.CheckTag())
{
throw new InvalidOperationException();
}
s.Close();
}
示例3: Close
public static void Close(SocketBase s)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
s.Close();
}
示例4: BindRandomPort
public static int BindRandomPort(SocketBase s, String addr)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
return s.BindRandomPort(addr);
}
示例5: Connect
public static void Connect(SocketBase s, String addr)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
s.Connect(addr);
}
示例6: SendIOv
// Send multiple messages.
//
// If flag bit ZMQ_SNDMORE is set the vector is treated as
// a single multi-part message, i.e. the last message has
// ZMQ_SNDMORE bit switched off.
//
public void SendIOv(SocketBase s, byte[][] a, int count, SendReceiveOptions flags)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
Msg msg;
for (int i = 0; i < count; ++i)
{
msg = new Msg(a[i]);
if (i == count - 1)
flags = flags & ~SendReceiveOptions.SendMore;
SendMsg(s, msg, flags);
}
}
示例7: Unbind
public static bool Unbind(SocketBase s, String addr)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
return s.TermEndpoint(addr);
}
示例8: RecvIOv
// Receive a multi-part message
//
// Receives up to *count_ parts of a multi-part message.
// Sets *count_ to the actual number of parts read.
// ZMQ_RCVMORE is set to indicate if a complete multi-part message was read.
// Returns number of message parts read, or -1 on error.
//
// Note: even if -1 is returned, some parts of the message
// may have been read. Therefore the client must consult
// *count_ to retrieve message parts successfully read,
// even if -1 is returned.
//
// The iov_base* buffers of each iovec *a_ filled in by this
// function may be freed using free().
//
// Implementation note: We assume zmq::msg_t buffer allocated
// by zmq::recvmsg can be freed by free().
// We assume it is safe to steal these buffers by simply
// not closing the zmq::msg_t.
//
public int RecvIOv(SocketBase s, byte[][] a, int count, SendReceiveOptions flags)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
int nread = 0;
bool recvmore = true;
for (int i = 0; recvmore && i < count; ++i)
{
// Cheat! We never close any msg
// because we want to steal the buffer.
Msg msg = RecvMsg(s, flags);
if (msg == null)
{
nread = -1;
break;
}
// Cheat: acquire zmq_msg buffer.
a[i] = msg.Data;
// Assume zmq_socket ZMQ_RVCMORE is properly set.
recvmore = msg.HasMore;
}
return nread;
}
示例9: SetSocketOption
public static void SetSocketOption(SocketBase s, ZmqSocketOptions option, Object optval)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
s.SetSocketOption(option, optval);
}
示例10: SocketMonitor
public static void SocketMonitor(SocketBase s, String addr, SocketEvent events)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
s.Monitor(addr, events);
}
示例11: Recv
// Receiving functions.
public static Msg Recv(SocketBase s, SendReceiveOptions flags)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
Msg msg = RecvMsg(s, flags);
if (msg == null)
{
return null;
}
// At the moment an oversized message is silently truncated.
// TODO: Build in a notification mechanism to report the overflows.
//int to_copy = nbytes < len_ ? nbytes : len_;
return msg;
}
示例12: Send
public static void Send(SocketBase s, byte[] buf, int len, SendReceiveOptions flags)
{
if (s == null || !s.CheckTag())
{
throw NetMQException.Create(ErrorCode.EFAULT);
}
Msg msg = new Msg(len);
msg.Put(buf, 0, len);
SendMsg(s, msg, flags);
}
示例13: Send
public static int Send(SocketBase s, byte[] buf, int len, SendRecieveOptions flags)
{
if (s == null || !s.CheckTag())
{
throw new InvalidOperationException();
}
Msg msg = new Msg(len);
msg.Put(buf, 0, len);
int rc = SendMsg(s, msg, flags);
if (rc < 0)
{
return -1;
}
return rc;
}
示例14: SetSocketOption
public static void SetSocketOption(SocketBase s, ZmqSocketOptions option, Object optval)
{
if (s == null || !s.CheckTag())
{
throw new InvalidOperationException();
}
s.SetSocketOption(option, optval);
}
示例15: SocketMonitor
public static bool SocketMonitor(SocketBase s, String addr, SocketEvent events)
{
if (s == null || !s.CheckTag())
{
throw new InvalidOperationException();
}
return s.Monitor(addr, events);
}