Skip to content

Instantly share code, notes, and snippets.

@jhawk28
Created October 29, 2010 18:28
Show Gist options
  • Save jhawk28/654077 to your computer and use it in GitHub Desktop.
Save jhawk28/654077 to your computer and use it in GitHub Desktop.
Causes Assertion failed: fds.size () <= FD_SETSIZE (\zeromq2\src\select.cpp:67)
import org.zeromq.ZMQ;
public class PushTest
{
public static void main(String[] args)
{
final ZMQ.Context ctx = ZMQ.context(1);
new Thread()
{
@Override
public void run()
{
ZMQ.Socket socket = ctx.socket(ZMQ.PULL);
socket.bind("tcp://*:5000");
boolean stop = false;
while (!stop)
{
String item = new String(socket.recv(0));
System.out.println(item);
if ("stop".equals(item))
{
stop = true;
}
}
socket.close();
}
}.start();
for (int i = 0; i < 50; i++)
send(ctx, "" + i);
send(ctx, "stop");
}
public static void send(final ZMQ.Context ctx, String string)
{
ZMQ.Socket socket = ctx.socket(ZMQ.PUSH);
socket.connect("tcp://localhost:5000");
socket.send(string.getBytes(), 0);
socket.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment