Socket#connect hangs for ever on wrong host/port
patri9ck opened this issue · 0 comments
patri9ck commented
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?