本文整理汇总了C#中NetMQSocket类的典型用法代码示例。如果您正苦于以下问题:C# NetMQSocket类的具体用法?C# NetMQSocket怎么用?C# NetMQSocket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetMQSocket类属于命名空间,在下文中一共展示了NetMQSocket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveSocket
public void RemoveSocket(NetMQSocket socket)
{
socket.EventsChanged -= OnSocketEventsChanged;
m_sockets.Remove(socket);
m_isDirty = true;
}
示例2: Socket
internal Socket(NetMQSocket socket, SocketConfiguration config)
{
socket.Options.Linger = config.Linger;
socket.Options.ReceiveHighWatermark = config.ReceivingHighWatermark;
socket.Options.SendHighWatermark = config.SendingHighWatermark;
this.socket = socket;
}
示例3: Transport
public Transport(NetMQSocket value) : this()
{
if (value != null)
{
this.socket = value;
}
}
示例4: DeviceBase
/// <summary>
/// Create a new instance of the <see cref="DeviceBase"/> class.
/// </summary>
/// <param name="poller">the <see cref="INetMQPoller"/> to use for detecting when messages are available</param>
/// <param name="frontendSocket">
/// A <see cref="NetMQSocket"/> that will pass incoming messages to <paramref name="backendSocket"/>.
/// </param>
/// <param name="backendSocket">
/// A <see cref="NetMQSocket"/> that will receive messages from (and optionally send replies to) <paramref name="frontendSocket"/>.
/// </param>
/// <param name="mode">the <see cref="DeviceMode"/> (either Blocking or Threaded) for this device</param>
/// <exception cref="ArgumentNullException">frontendSocket must not be null.</exception>
/// <exception cref="ArgumentNullException">backendSocket must not be null.</exception>
protected DeviceBase(INetMQPoller poller, NetMQSocket frontendSocket, NetMQSocket backendSocket, DeviceMode mode)
{
m_isInitialized = false;
if (frontendSocket == null)
throw new ArgumentNullException("frontendSocket");
if (backendSocket == null)
throw new ArgumentNullException("backendSocket");
FrontendSocket = frontendSocket;
BackendSocket = backendSocket;
FrontendSetup = new DeviceSocketSetup(FrontendSocket);
BackendSetup = new DeviceSocketSetup(BackendSocket);
m_poller = poller;
FrontendSocket.ReceiveReady += FrontendHandler;
BackendSocket.ReceiveReady += BackendHandler;
m_poller.Add(FrontendSocket);
m_poller.Add(BackendSocket);
m_runner = mode == DeviceMode.Blocking
? new DeviceRunner(this)
: new ThreadedDeviceRunner(this);
}
示例5: ConnectOrBindAddress
public void ConnectOrBindAddress(NetMQSocket socket)
{
var port = socket.BindRandomPort(Uri.AbsoluteUri.TrimEnd('/'));
var address = $"{Uri.Scheme}://{Uri.Host}:{port}";
Uri = new Uri(address);
}
示例6: WebSocketClient
internal WebSocketClient(NetMQSocket streamSocket, byte[] identity)
{
m_state = WebSocketClientState.Closed;
m_streamSocket = streamSocket;
m_outgoingMessage = null;
Identity = identity;
}
示例7: Proxy
/// <summary>
/// Create a new instance of a Proxy (NetMQ.Proxy)
/// with the given sockets to serve as a front-end, a back-end, and a control socket.
/// </summary>
/// <param name="frontend">the socket that messages will be forwarded from</param>
/// <param name="backend">the socket that messages will be forwarded to</param>
/// <param name="control">this socket will have messages also sent to it - you can set this to null if not needed</param>
/// <param name="poller">an optional external poller to use within this proxy</param>
public Proxy([NotNull] NetMQSocket frontend, [NotNull] NetMQSocket backend, [CanBeNull] NetMQSocket control = null, Poller poller = null)
{
m_frontend = frontend;
m_backend = backend;
m_control = control;
m_externalPoller = poller != null;
m_poller = poller;
}
示例8: DoServer
protected override void DoServer(NetMQSocket socket, int messageSize)
{
for (int i = 0; i < Iterations; i++)
{
byte[] message = socket.Receive();
socket.Send(message);
}
}
示例9: MDPClient
/// <summary>
/// setup the client with standard values
/// verbose == false
/// timeout == 2500
/// reties == 3
/// </summary>
private MDPClient()
{
m_ctx = NetMQContext.Create ();
m_client = null;
Timeout = TimeSpan.FromMilliseconds (2500);
Retries = 3;
m_connected = false;
}
示例10: NmqMessageSender
internal NmqMessageSender(Uri serviceUri)
{
context = NetMQContext.Create();
socket = context.CreateRequestSocket();
var address = string.Format("tcp://{0}:{1}", serviceUri.Host, serviceUri.Port);
socket.Connect(address);
}
示例11: OutputWriter
/// <summary>
/// Initializes a new instance of the <see cref="Logit.Zmq.OutputWriter"/> class.
/// </summary>
/// <param name="zt">ØMQ Transport to use.</param>
public OutputWriter(Transport zt) : base(CultureInfo.InvariantCulture)
{
if (zt != null)
{
this.socket = zt.Socket;
}
}
示例12: SetupPublisher
private void SetupPublisher()
{
Open(0);
_publisherSocket = _context.CreatePublisherSocket();
_publisherSocket.Bind(_configuration.PublisherAddress);
}
示例13: FeedZmQPublisher
public FeedZmQPublisher(string address, ILog log)
{
_log = log;
_context = NetMQContext.Create();
_socket = _context.CreatePushSocket();
_socket.Bind(address);
}
示例14: Start
public async Task Start ()
{
ThrowIfDisposed ();
var ct = cancellationTokenSource.Token;
nmqPoller = new Poller ();
nmqScheduler = new NetMQScheduler (nmqContext, nmqPoller);
nmqServer = nmqContext.CreateResponseSocket ();
nmqServer.Bind (Address.AbsoluteUri.TrimEnd ('/'));
serverTask = Task.Factory.StartNew (() => {
ct.ThrowIfCancellationRequested ();
while (true) {
if (ct.IsCancellationRequested) {
// clean up here
ct.ThrowIfCancellationRequested ();
}
var msg = nmqServer.Receive ();
var request = Request.Deserialize (msg);
var result = Handle (request);
byte[] output_buffer = result.Serialize ();
nmqServer.Send (output_buffer);
}
}, ct);
await serverTask;
}
示例15: MDPClient
/// <summary>
/// setup the client with standard values
/// verbose == false
/// timeout == 2500
/// reties == 3
/// </summary>
private MDPClient ()
{
m_client = null;
Timeout = TimeSpan.FromMilliseconds (2500);
Retries = 3;
m_connected = false;
}