// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import org.zeromq.SocketType;
import org.zeromq.ZMQ;
import org.zeromq.ZContext;

public class Cli4
{
    private static void test(String addr) {
        try (ZContext ctx = new ZContext()) {
            ZMQ.Socket s = ctx.createSocket(SocketType.PUSH);
            s.connect(addr);
            for(int i = 0; i < 3; i++) {
                String reqmsg = "Java client";
                s.send(reqmsg);
            }
            try {
                Thread.sleep(1000);
            } catch(InterruptedException ex) {
            }
            s.close();
        }
    }
    public static void main(String[] args) throws Exception
    {
        test("tcp://localhost:10001");
        test("tcp://localhost:10002");
        test("tcp://localhost:10003");
        test("tcp://localhost:10004");
        test("tcp://localhost:10005");
        test("tcp://localhost:10006");
    }
}
