EntireX 6.2.1 Timeout

Hi,
I am trying to set the timeout value in a client which uses EntireX Broker 6.2.1. I wrote a small test app that tries to send a message to a port that is not listening. What I’m seeing is that it doesn’t matter what I set the entirex.timeout to, it always takes about 20 seconds to timeout on windows and about 200 seconds on unix (which is my target platform). I’ve also tried setting ETB_TIMEOUT and had the same results. Below is my test app:
try {
System.setProperty(“entirex.timeout”, timeout);
//System.setProperty(“ETB_TIMEOUT”, timeout);
Broker.setTrace(4);
// try to connect to a port that is not listening
Broker broker = new Broker(“205.100.100.05:1111”, “myuser”);

  BrokerService bService = new BrokerService(broker, "whatever")

;
//set max receive length
bService.setMaxReceiveLen(200);
BrokerMessage bRequest = new BrokerMessage();
BrokerMessage bReply = new BrokerMessage();

  bRequest.setMessage("Hello");
  System.out.println("Message has been set");
  startTime = System.currentTimeMillis();
  bReply = bService.sendReceive(bRequest);
  System.out.println("Message has been sent");

}
catch (Exception e) {
  endTime = System.currentTimeMillis();
  System.out.println("Exception: " + e.getMessage());
  System.out.println("time lapsed: " + (endTime - startTime));
}

}

  1. Is timeout supported in this version of the product?
  2. Is there something I need to configure to timeout the connection?

The reason I’m using this version of EntireX is I’m trying to solve a timeout issue in a system that uses this version.
Thank you for your help.

Peggy

Hi Peggy,

with the entirex.timeout property you can specify the socket timeout. This only applies to already established socket connections, see tha Java doc of java.net.Socket.setSoTimeout(int).

You are looking for the connection timeout. You need to check the docu of your JVM, on Sun’s Java 6 there is a property sun.net.client.defaultConnectTimeout which you could use. See http://java.sun.com/javase/6/docs/technotes/guides/net/properties.html for details.

Hi Rolf,

Thanks for your quick response. I’m still a bit confused and not able to get the timeout behaviour that I need.

I’m trying to force the sendReceive call to timeout quickly when my server has gone down.
I’m calling the setDefaultWaittime to “10S”, which I thought would cause my sendReceive to timeout if it takes longer than 10 seconds. I’ve also tried setting wait parameter on each sendReceive call.

I am getting a socket connection timeout but it takes awhile. I would like to force it to timeout quicker. Since sockets are being allocated by the broker, I don’t see how I can set the connection timeout time.

I’ve tried setting the system property: sun.net.client.defaultConnectTimeout but that doesn’t seem to affect it. The documentation says this is used to set the default connect timeout for the protocol handler used by java.net.URLConnection - a socket connect doesn’t use this protocol handler, does it?

Here is what I’m seeing in my trace:
2008-10-21 10:26:46.696/main Allocating new socket for 204.230.205.22:1900 (1)
2008-10-21 10:26:46.696/Thread-0 CleanupPool: started, timeout = 300000
2008-10-21 10:27:05.243/main Broker Error 0013 0315: Socket connect failed for 204.230.205.22:1900 (java.net.ConnectException: Connection timed out: connect)
Exception: Socket connect failed for 204.230.205.22:1900 (java.net.ConnectException: Connection timed out: connect)

Thanks again for your help.
Peggy

Hi Peggy,

you are still getting the Connection timed out error. As I already mentioned this timeout value cannot be specified/changed.

You are right, the system property I mentioned applies to URL connections but not to socket connections, sorry.

Hello everybody,

Just a stupid proposal: Have you the good definition of your ETB machine in the hosts file?

In fact, before, I received the same error and when I checked in

c:/windows/system32/drivers/etc/hosts

I made constatation that the broker defined in the java example hadn’t the good IP adress. (The broker Id had a another server IP adress where I was not registred)