jeromq icon indicating copy to clipboard operation
jeromq copied to clipboard

Socket#connect hangs for ever on wrong host/port

Open patri9ck opened this issue 1 year ago • 0 comments

Consider this code:

try (ZContext zContext = new ZContext(); ZMQ.Socket client = zContext.createSocket(SocketType.REQ)) {
            client.setLinger(0);
            client.setSendTimeOut(0);
            client.setReceiveTimeOut(0);

            client.setImmediate(false);

            client.connect("tcp://" + host + ":" + port);

The connect call blocks the thread for ever if host is for example 223232 and port 22323 (something that doesn't make sense). For my application the host and port rely on user input so that is a problem. Can that be somehow avoided from happening?

patri9ck avatar Jul 06 '22 21:07 patri9ck