java.net.SocketTimeoutException: Read timed out

  • Hi,


    Conquest's core assumption is that it can read one or a few images in memory - this cannot be changed. With ReadAheadThread=0 in dicom.ini it should only read one, otherwise it reads 5. I do not think it has a leak (we should check that) so your memory use is 'real' given that assumption. If you retrieve a singe big image at a time, what does the memory use show?


    A still think the solution is to add as much memory as one series that is likely to be retrieved at a time.


    Marcel

  • java.net.SocketTimeoutException: Read timed out

    Your Java socket is timing out (throws java.net.SocketTimeoutException: Connection timed out) means that it takes too long to get respond from other device and your request expires before getting response.


    You can effectively handle it from client side by define a connection timeout and later handle it by using a try/catch/finally block. You can use the connect(SocketAddress endpoint, int timeout) method and set the timeout parameter:


    Code
    Socket socket = new Socket();
    SocketAddress socketAddress = new InetSocketAddress(host, port);
    socket.connect(socketAddress, 12000); //12000 are milli seconds


    From server side you can use the setSoTimeout(int timeout) method to set a timeout value. The timeout value defines how long the ServerSocket.accept() method will block:


    Code
    ServerSocket serverSocket = new new ServerSocket(port);
    serverSocket.setSoTimeout(12000);


    So to avoid this exception in another way, you should keep the connection be alive using the method Socket.setKeepAlive() method although possibly you have not used the method setTimeout() , meaning asking the socket to unlimited block to receive.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!