-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
We have a specific problem that is causing problems making connections in CS-Studio.
An IOC is responding to UDP broadcasts, but it is then not possible to open a channel using SocketChannel.open(), which times out after some unspecified time, about 1 minute in this case. Because the code in CAConnector.java calls SocketChannel.open() three times in succession, JCA takes 3 minutes before it fails and tries again to make a connection. If there are multiple channels from the same IOC it will effectively block all new connections in CS-Studio.
The least invasive way to improve this is to put a timeout on these connections, which can be done something like this:
SocketChannel sc = SelectorProvider.provider().openSocketChannel();
sc.configureBlocking(false);
sc.connect(address);
for (int i = 0; i < 20; i++) {
if (sc.finishConnect()) {
return sc;
}
Thread.sleep(50);
}
Returning the SocketChannel before it has connected is more tricky.
Metadata
Metadata
Assignees
Labels
No labels