// 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.REQ);
            s.connect(addr);
            String reqmsg = "Java client";
            s.send(reqmsg);
            String respmsg = s.recvStr();
            System.out.println(respmsg);
            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");
    }
}
