Skip to content

Socket#connect hangs for ever on wrong host/port #918

Open
@patri9ck

Description

@patri9ck

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions