This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
using (Context context = Context.Create()) | |
{ | |
using (var socket1 = context.CreateResponseSocket()) | |
{ | |
socket1.Bind("tcp://127.0.0.1:82"); | |
while (true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (NetMQContext ctx = NetMQContext.Create()) | |
{ | |
using (var server = ctx.CreateResponseSocket()) | |
{ | |
server.Bind("tcp://127.0.0.1:5556"); | |
using (var client = ctx.CreateRequestSocket()) | |
{ | |
client.Connect("tcp://127.0.0.1:5556"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void InProcWorkers() | |
{ | |
int count = 100; | |
int workers = 10; | |
using (NetMQContext context = NetMQContext.Create()) | |
{ | |
using (var response = context.CreateResponseSocket()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create server and client sockets and connect over inproc | |
zsock_t *server = zsock_new_server ("@inproc://zframe-server.test"); | |
zsock_t *client = zsock_new_client (">inproc://zframe-server.test"); | |
// Send message from client to server | |
zframe_t frame = zframe_new ("Hello", 5); | |
int rc = zframe_send (&frame, client, 0); | |
// Read message | |
frame = zframe_recv (server); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void* ctx = zmq_ctx_new(); | |
void* client = zmq_socket(ctx, ZMQ_CLIENT); | |
// creating new pollfd, pollfd is per thread. | |
void* pollfd = zmq_pollfd_new(); | |
// associate pollfd with client, you can associate multiple pollfd with one socket for multi threading | |
zmq_add_pollfd(client, pollfd); | |
zmq_pollitem_t items[] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Client | |
{ | |
/// <summary> | |
/// List of address to connect to. Will connect to the first one responding. Connected address can changed if disconnected. | |
/// </summary> | |
public void Connect(IEnumerable<string> addresses) | |
{ | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main (void) | |
{ | |
setup_test_environment (); | |
int i; | |
for (i = 0; i < 100; i++) | |
{ | |
void *ctx = zmq_ctx_new (); | |
assert (ctx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<class name = "zstruct"> | |
<!-- | |
Copyright (c) the Contributors as noted in the AUTHORS file. | |
This file is part of CZMQ, the high-level C binding for 0MQ: | |
http://czmq.zeromq.org. | |
This Source Code Form is subject to the terms of the Mozilla Public | |
License, v. 2.0. If a copy of the MPL was not distributed with this | |
file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Client : MonoBehaviour | |
{ | |
private SubscriberSocket m_subscriber; | |
private NetMQContext m_context; | |
// Use this for initialization | |
void Start() | |
{ | |
ForceDotNet.Force(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zsock_t *radio = zsock_new_radio ("inproc://zframe-test-radio"); | |
zsock_t *dish = zsock_new_dish ("inproc://zframe-test-radio"); | |
// Use following for multicast | |
// zsock_t *radio = zsock_new_radio ("udp://239.0.0.1:55555"); | |
// zsock_t *dish = zsock_new_dish ("udp://239.0.0.1:55555"); | |
// Join to group | |
rc = zsock_join (dish, "World"); | |
assert (rc == 0); |
OlderNewer