Socket Timeout During GetUpdates
search cancel

Socket Timeout During GetUpdates


Article ID: 340610


Updated On:


VMware vCenter Server


How can I handle socket timeouts when I'm running the GetUpdates operation?


VMware VirtualCenter 1.0.x
VMware VirtualCenter 1.2.x
VMware VirtualCenter 1.1.x


Socket timeouts are normal and expected when using sockets for interprocess communication. SDK users must code their clients to accept timeouts and retry the GetUpdates operation.

You can add the following sample catch clause for the timeout exception to your client code:

 catch (Exception ex) {    String exMsg = ex.getMessage();    if (exMsg.indexOf("Read timed out") >= 0) {       // Catch socket timeouts.       System.out.println("Read Timeout doing GetUpdates. Redoing GetUpdates.");    } else {       // Other exceptions are noted and passed on.       System.out.println("Got Exception in GetUpdates: " + ex.getMessage());       ex.printStackTrace(System.out);       throw ex;    } }

In some situations, you may also want to increase the length of the socket timeout period. The following sample code changes the timeout for a Java client using Axis 1.1:

 VmaBindingStub vma = new VmaBindingStub(endPointURL, vmaService); //Set socket timeout to 30 minutes or 1800 seconds. ((org.apache.axis.client.Stub)this.vma).setTimeout(1800000);