本文整理汇总了C#中NetMQSocket类的典型用法代码示例。如果您正苦于以下问题:C# NetMQSocket类的具体用法?C# NetMQSocket怎么用?C# NetMQSocket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetMQSocket类属于命名空间,在下文中一共展示了NetMQSocket类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RemoveSocket
public void RemoveSocket(NetMQSocket socket)
{
socket.EventsChanged -= OnSocketEventsChanged;
m_sockets.Remove(socket);
m_isDirty = true;
}
开发者ID:bubbafat,项目名称:netmq,代码行数:7,代码来源:Poller.cs
示例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;
}
开发者ID:gitter-badger,项目名称:kino,代码行数:7,代码来源:Socket.cs
示例3: Transport
public Transport(NetMQSocket value) : this()
{
if (value != null)
{
this.socket = value;
}
}
开发者ID:georgesimms,项目名称:logit-dotnet,代码行数:7,代码来源:Transport.cs
示例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);
}
开发者ID:awb99,项目名称:netmq,代码行数:41,代码来源:DeviceBase.cs
示例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);
}
开发者ID:simonbaas,项目名称:EasyZMq,代码行数:7,代码来源:BindRandomPortAddressBinder.cs
示例6: WebSocketClient
internal WebSocketClient(NetMQSocket streamSocket, byte[] identity)
{
m_state = WebSocketClientState.Closed;
m_streamSocket = streamSocket;
m_outgoingMessage = null;
Identity = identity;
}
开发者ID:lufka,项目名称:NetMQ.WebSockets,代码行数:8,代码来源:WebSocketClient.cs
示例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;
}
开发者ID:bbqchickenrobot,项目名称:netmq,代码行数:16,代码来源:Proxy.cs
示例8: DoServer
protected override void DoServer(NetMQSocket socket, int messageSize)
{
for (int i = 0; i < Iterations; i++)
{
byte[] message = socket.Receive();
socket.Send(message);
}
}
开发者ID:bbqchickenrobot,项目名称:netmq,代码行数:8,代码来源:LatencyBenchmark.cs
示例9: Send
public static bool Send(Message message, NetMQSocket socket)
{
Send(message.UUID, socket);
Send(Delimeter, socket);
Send(string.Empty, socket);
Send(JsonSerializer.Serialize(message.Header), socket);
Send(JsonSerializer.Serialize(message.ParentHeader), socket);
Send(JsonSerializer.Serialize(message.MetaData), socket);
Send(message.Content, socket, false);
return true;
}
开发者ID:ashwinsathyar,项目名称:icsharp,代码行数:12,代码来源:MessageSender.cs
示例10: Send
public Action<NetMQMessage> Send(NetMQSocket socket, PendingResRequest pendingRequest, Guid requestId)
{
var pending = (PendingResRequest<QueryEventsForStreamResponse>) pendingRequest;
var msg = new NetMQMessage();
msg.AppendEmptyFrame();
msg.Append(ResProtocol.ResClient01);
msg.Append(ResCommands.QueryEventsByStream);
msg.Append(requestId.ToByteArray());
msg.Append(_context);
msg.Append(_stream);
msg.Append(_fromVersion.ToNetMqFrame());
msg.Append(_maxVersion.ToNetMqFrame());
socket.SendMultipartMessage(msg);
return m =>
{
var command = m.Pop().ConvertToString();
if (command == ResCommands.Error)
{
var errorCode = m.Pop().ConvertToString();
var errorDetails = m.Pop().ConvertToString();
ErrorResolver.RaiseException(errorCode, errorDetails, pending.SetException);
return;
}
if (command != ResCommands.QueryEventsByStreamResponse)
pending.SetException(new UnsupportedCommandException(command));
var count = m.PopInt32();
var events = new EventInStorage[count];
for (var i = 0; i < count; i++)
{
var id = new Guid(m.Pop().ToByteArray());
var streamId = m.Pop().ConvertToString();
var context = m.Pop().ConvertToString();
var sequence = m.PopInt64();
var timestamp = m.PopDateTime();;
var type = m.PopString();
var headers = m.PopStringOrNull();
var body = m.PopString();
events[i] = new EventInStorage(context, streamId, sequence, type, id, headers, body, timestamp);
}
var result = new QueryEventsForStreamResponse(_context, _stream, events);
pending.SetResult(result);
};
}
开发者ID:heartysoft,项目名称:res,代码行数:52,代码来源:QueryEventsForStreamRequest.cs
示例11: AddSocket
public void AddSocket(NetMQSocket socket)
{
if (m_sockets.Contains(socket))
{
throw new ArgumentException("Socket already added to poller");
}
m_sockets.Add(socket);
socket.EventsChanged += OnSocketEventsChanged;
m_isDirty = true;
}
开发者ID:bubbafat,项目名称:netmq,代码行数:13,代码来源:Poller.cs
示例12: 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="controlIn">this socket will have incoming messages also sent to it - you can set this to null if not needed</param>
/// <param name="controlOut">this socket will have outgoing 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 controlIn, [CanBeNull] NetMQSocket controlOut, [CanBeNull] INetMQPoller poller = null)
{
if (poller != null)
{
m_externalPoller = true;
m_poller = poller;
}
m_frontend = frontend;
m_backend = backend;
m_controlIn = controlIn;
m_controlOut = controlOut ?? controlIn;
}
开发者ID:somdoron,项目名称:netmq,代码行数:22,代码来源:Proxy.cs
示例13: ProcessMessage
public void ProcessMessage(NetMQMessage message, NetMQSocket socket)
{
if (message.FrameCount < 3)
throw new MalformedMessageReceivedException(message.FrameCount);
var sender = message.PopUntilEmptyFrame();
var protocolFrame = message.Pop();
var protocol = protocolFrame.ConvertToString();
ensureProtocol(protocol);
var command = message.Pop().ConvertToString();
_dispatcher.Dispatch(command, sender, message);
}
开发者ID:heartysoft,项目名称:res,代码行数:13,代码来源:TcpIncomingMessageProcessor.cs
示例14: CreateMonitor
private NetMQMonitor CreateMonitor(NetMQContext context, NetMQSocket socket, Poller poller)
{
var monitor = new NetMQMonitor(context, socket, $"inproc://{Guid.NewGuid()}.inproc",
SocketEvents.Connected | SocketEvents.Disconnected | SocketEvents.ConnectRetried);
monitor.Connected += Monitor_Connected;
monitor.Disconnected += Monitor_Disconnected;
monitor.ConnectRetried += Monitor_ConnectRetried;
monitor.AttachToPoller(poller);
return monitor;
}
开发者ID:simonbaas,项目名称:EasyZMq,代码行数:13,代码来源:ConnectionMonitor.cs
示例15: 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;
}
开发者ID:wangkai2014,项目名称:netmq,代码行数:14,代码来源:MDPClient.cs
示例16: 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);
}
开发者ID:yonglehou,项目名称:DistributedCommunicationDotNet,代码行数:7,代码来源:NmqMessageSender.cs
示例17: 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;
}
}
开发者ID:georgesimms,项目名称:logit-dotnet,代码行数:11,代码来源:OutputWriter.cs
示例18: SetupPublisher
private void SetupPublisher()
{
Open(0);
_publisherSocket = _context.CreatePublisherSocket();
_publisherSocket.Bind(_configuration.PublisherAddress);
}
开发者ID:snowattitudes,项目名称:SignalR.Backplane.NetMQ,代码行数:7,代码来源:NetMQScaleoutMessageBus.cs
示例19: FeedZmQPublisher
public FeedZmQPublisher(string address, ILog log)
{
_log = log;
_context = NetMQContext.Create();
_socket = _context.CreatePushSocket();
_socket.Bind(address);
}
开发者ID:Grovesy,项目名称:Feeds,代码行数:7,代码来源:FeedZmQPublisher.cs
示例20: 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;
}
开发者ID:nerdshark,项目名称:CSharpReplAddin,代码行数:29,代码来源:CSharpReplServer.cs
注:本文中的NetMQSocket类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论