Plsql - set a timeout on utl_tcp connection

hi,
I have a utl_tcp connection and I want to define the timeout parameter before each read.
How? thanks...

UTL_TCP pretty much runs directly on the standards sockets interface. It does very little to no additional abstraction, or inserting additional management/state code in between you the caller, and the sockets interface. So it is pretty much standard (client) tcp socket programming as far as using UTL_TCP is concerned.
How are you making the write message socket calls via UTL_TCP ?
You will only "immediately" see a connection error on socket write when it is done in blocking mode - and "immediately" can mean several minutes of waiting for that blocking call to complete and return an error using the native socket interface.
Note that the A side will only know that the B side is gone when the B side sends a tcp packet with the FIN bit set in the header. As the B side crashes, that does not happen. So the protocol stack on A still believes (quite correctly) that the B side is still there. The A side needs to actively use the connection and send something to the B side in order to determine the B side is gone. And the speed of this "failure" is pretty much dependent on the infrastructure in-between and the time it takes for that tcp packet to die and the A side protocol stack receiving a RST telling it to reset its connection as it failed.
tcp was designed to be very robust. It does not simply throw in the towel.. {noformat} ;-) {noformat}

Similar Messages

  • Is there any way to set read timeout on JDBC connection?

    When the network connectivity between the machine
    where Database is running and where the application is running breaks,
    the query executed using the old connection handle is not timing out.
    Is there any way to set read timeout on JDBC connection. ?
    FYI, Oracle JDBC thin Driver is used in our application.

    Set the tuning parameters with Embedded OC4J Server Preferences>Current Workspace>Data Sources>jdev-connection-DBConnection1 node.
    Select the Tuning tab.
    The Inactivity Timeout parameter specifies the number of secs of inactivity after which a connection gets disconnected.

  • Set timeout for URL connection in java1.4

    hi
    I want to set timeout for URL connection in java 1.4..
    java 5.0 provides with a setTimeout(int ) method but how should it be done in 1.4 environment
    Thanks in advance
    sneha

    sun.net.client.defaultConnectTimeout (default: -1)
    sun.net.client.defaultReadTimeout (default: -1)
    See the [Networking Properties|http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html].

  • How do i set the timeout value?

    I'm doing an insert...in the insert i have a trigger that fires a http put. when i'm doing a couple inserts at a time, it works fine. However if i try to insert about 50 at one time (within msecs of each other) then i get the following error:
    ORA-29276 transfer timeout
    Cause: Timeout occurred while reading from or writing to a network connection.
    Action: Check the remote server or the network to ensure that it responds within the timeout limit. Or increase the timeout value.
    My question is, how do i set this timeout value?

    FYI,
    IFS.PROTOCOLSERVER.SESSION.DEFAULT.Timeout
    IFS.PROTOCOLSERVER.SessionStateTimeoutPeriod
    IFS.PROTOCOLSERVER.SessionStateTimeoutPeriod
    in cup server configuration

  • How to set HttpURLConnection timeout while reading a stream?

    I want it got time out if the connection if lose while i read a stream from URL
    try {
         int timeout = 700;
         HttpURLConnection connection = (HttpURLConnection) downloadURl.openConnection();
         connection.setConnectTimeout(timeout);
         connection.setRequestProperty("Range","bytes=" + downloaded + "-");
         connection.connect();
         if (connection.getResponseCode() / 100 != 2) {
              error();
         int contentLength = connection.getContentLength();
         if (contentLength < 1) {
              error();
         if (status == DOWNLOADING){
              if (size == -1) {
                   size = contentLength;
              file = new RandomAccessFile(saveTmpName+".tmp", "rw");
              file.seek(downloaded);
         byte buffer[];
         stream = connection.getInputStream();
    connection.setReadTimeout(timeout);
         while (status == DOWNLOADING) { 
              if (size - downloaded > MAX_BUFFER_SIZE) {
                   buffer = new byte[MAX_BUFFER_SIZE];
              } else {
                   buffer = new byte[(int)(size - downloaded)];
              int read = stream.read(buffer); // how to set timeout while it is reading stream
              if (read <= 0)
                   break;
              file.write(buffer, 0, read);
              downloaded += read;
         if (status == DOWNLOADING) {
              status = COMPLETE;
    } catch (SocketTimeoutException  e) {
         error();
    } catch (IllegalArgumentException e) {
         error();
    } catch (Exception e) {
         error();
    } finally {
         if (file != null) {
              try {
                   file.close();
              } catch (Exception e) {}
         if (stream != null) {
              try {
                   stream.close();
              } catch (Exception e) {}
    }I try to set "setReadTimeout()" but is still not through timeout Exception

    ejp wrote:
    Because, there's no FTP client command that allows to do such thing.Socket.setSoTimeout().I agree with you on this one but the OP is talking about the FTPClient API from Apache.
    To the OP,
    BTW, I have reread the Javadoc about the [*API*|http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html] : indeed, there's no setTimeout method, but there is a setDataTimeout method : +Sets the timeout in milliseconds to use when reading from the data connection+ .

  • UTL_TCP - connection loss

    Hi guys,
    I would need a help with UTL_TCP package...
    Oracle version is:
    SELECT * FROM V$VERSION;
    Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE    11.2.0.2.0    Production"
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    I have a package which handles communication with another system over tcp. In the package, there is a private global variable of type UTL_TCP.Connection which holds the connection record after I open a connection. I normally send data using UTL_TCP.Write_Text function.
    This works fine until a moment when the connection probably breaks or something else happens. After that, when I try to call UTL_TCP.Write_Text, it fails because the global structure holding connection details is already null - namely remote_host and remote_port are suddenly set to null. Calling UTL_TCP.Write_Text then throws an exception:
    ORA-29260: network error: not connected
    Please note the description...
    Does anyone has an idea how can this happen???
    I know that these fields are set to null when I call UTL_TCP.CLOSE_CONNECTION, but this I don't call at all (only at the end when closing the application). I have put a logging into my function which holds the call to UTL_TCP.CLOSE_CONNECTION to be 100% sure that this isn't invoked and it isn't.
    In the documentation to UTL_TCP package I see:
    remote_host
    Name of the remote host when connection is established. NULL when no connection is established.
    remote_port
    Port number of the remote host connected. NULL when no connection is established.
    So I thought that when there is a connection break because of any reason, maybe Oracle itself could set these fields to null...
    I have created a test package with just 2 functions - one for opening a connection, one for sending some data. Now, I connect to some listening application, send some data, then I close or kill that remore application and try to send some data to it.
    To me is very strange that when I do that, I am always able to make two successful calls of UTL_TCP.Write_Text function and the third call always fails with following error:
    ORA-29260: network error: TNS:lost contact
    See that the ORA number is the same, but description is different.
    Is there any difference between these two errors - how is it possible that same ORA error has different description?
    How is it possible that remote_host and remote_port are suddenly set to Null?
    Thanks a lot for help,
    Dan

    I found the problem.
    1) The difference between two descriptions of ORA-29260 is that
    network error: not connected - is displayed when trying to send the data and the connection structure is null, meaning we are not connected to the remote system
    network error: TNS:lost contact - is displayed when we were connected (connection structure is not null), but the connection is lost for some reason
    2) The problem with connection structure suddently set to null was happening because we were using different DB session from time to time. So it was happening that we were trying send the data in session where we were not connected to remote process.

  • JDBC / JTA Timeouts : How to set a timeout on the fetching of a query ?

    Hi !
    I'm working on an Application running on Weblogic Server 11g. This app executes a query on an Oracle 11g database ...
    The problem is that this query returns millions of records ... and the app fetches the results during tens of minutes.
    We would like to set a timeout, wich will abandon the transaction, hang the database connection, destroy the socket ... or anything else ...
    This timeout will prevent the thread to become in STUCK state and stucking the weblogic managed server.
    Is this possible ?
    Thank's for your answers.
    Steve.
    Edited by: 966918 on 10 avr. 2013 07:18

    Abandon timeout will not help. That is only used if a database crashes during the second phase of commit. It specifies how long the transaction manager should keep trying to complete the transaction.
    JTA timeout will only work if you are using XA datasources and two-phase commit transactions. When the timeout occurs, it guarantees that the transaction cannot be committed. Eventually, all of the participant resources will be notified and will not allow any more work to take place on the transaction. It does not stop the threads and the application must be written to handle exceptions appropriately.
    Edited by: Steve Felts on Apr 17, 2013 8:32 AM

  • How do set operation timeout in tomcat server?

    hi all
    suppose i have one endless loop program(jsp) that program run under tomcat server,
    so it's keep on runing in tomcat server.
    i want, after some time the server send error message like operation timeout.
    how do set operation timeout in tomcat server?
    if anybody know help me.
    my mail id [email protected]

    Well, the server.xml file has connection time outs, but that is for idle time, I think... I'm not sure what would happen in a loop... , especially if you are sending some data back to the client in each iteration. Generally you shouldn't be starting a loop that will really run forever. Maybe have some type of counter to break out if something hasn't occurred within x iterations, or create a separate thread that can sleep for x seconds and set a flag to break the loop after that time.

  • JDBC & setQueryTimeout - or is there another way to set query timeout?

    I am trying to set query timeout for TimesTen using jdbc library. But it seems like TimesTen jdbc library does not support setQueryTimeOut. Is there a way to set it without having to set it statically in the DNS?
    I tried to set the SqlQueryTimeout in the connection string but it doesn't work either:
         Connection connection = DriverManager.getConnection(
         "jdbc:timesten:client:TTC_SERVER=bleh;TCP_PORT=17013;TTC_Server_DSN=blah;TTC_Timeout=0;SqlQueryTimeout=5;");
    Thanks for your help!

    Thanks for replying. I don't know have good knowledge on Cache Connect. I will have to read on that first.
    It seems like TimesTen does not support jdbc setQueryTimeout. Calling this method on TimesTen jdbc library will return false: supportsQueryTimeout().
    I created a test class for testing the SqlQueryTimeout. I set the TTC_Timeout to 400 seconds and SqlQueryTimeOut to 5 seconds. So after 5 seconds it should time out.
    The way I test it is by putting a break point before executing the query, do a route add DBServer to an un-connectible gateway to simulate the network delay/connection problem and then continue after I added the route.
    After executing the query, instead of timing out after 5 second, it will wait for a few minutes before timing out.
    The code for testing the timeout is as follow:
    public class TTTest {
         public static void main(String[] args) throws ClassNotFoundException {
         Class.forName("com.timesten.jdbc.TimesTenDriver");
         try {
         Connection connection = DriverManager.getConnection(
         "jdbc:timesten:client:TTC_SERVER=server;TCP_PORT=17013;TTC_Server_DSN=server_dns;"
         + "TTC_Timeout=400;SqlQueryTimeout=5;");
         System.out.println(connection.getClass().getName());          
         Statement stmt = connection.createStatement();
         //com.timesten.jdbc.JdbcOdbcStatement stmt = (JdbcOdbcStatement)connection.createStatement();     
         System.out.println(stmt.getClass().getName());
         System.out.println("Query started " + new Date());
    // Pause here, put a route add and continue
         ResultSet rs = stmt.executeQuery("select count(*) from mse");
         rs.next();
         System.out.println("there are " + rs.getInt(1) + " rows");
         rs.close();
         stmt.close();
         connection.close();          
         } catch (Exception x) {           
         x.printStackTrace(System.err);
         System.err.println(new Date());
    }

  • Setting a timeout for HttpConnection?

    Hi,
    Is there any way to set a timeout for an HttpConnection instance? I've got something like:
    HttpConnection conn = (HttpConnection)Connector.open("www.mysite.com");
    but the timeout on my particular device waits 2 minutes! I'd like to make it something more like 20 seconds. Any way to do this?
    Thanks

    I am surprised that HttpConnection doesn't have a way to timeout already. I searched thru the docs and I cant find any.
    Anyway this is my solution. Use a Thread. Start the thread before calling Connector.open. In the run method of the thread, sleep for 20 secs, wake up and display something to the user. This is assuming that your Connector.open is not blocking. i.e its in a thread of its own. this is an example of a non-blocking httpconnection
      public void commandAction(Command c, Displayable s) {
            if (c.getLabel().equals("GET")) {
                final MIDlet middy = this;
                new Thread() {
                    public void run() {
                        try {
                            //make your http connection here.
                            HttpConnection conn = (HttpConnection)Connector.open("www.mysite.com");
                        } catch (Exception ie) {
                            ie.printStackTrace();
                }.start();
        }of course there are other ways to do that. just my suggestion

  • How to set command timeout for table object?

    I have a report that is generating an error during rendering in a CrystalReportViewer control (v10.5).  The error is "Failed to open a rowset." which appears to be caused by a timeout.  I'm currenlty setting the connection info and location of the sproc programmatically.  How can I set the command timeout as well?  Can I set this via the Attributes collection of the ConnectionInfo object?  (This appears to be a command timeout, not a connection timeout, which I'm already including in the Attributes collection of the ConnectionInfo object and setting at 15 seconds.  I've tried making this as much as 60 seconds but it doesn't change the behavior.)

    The error message includes text that states the timeout was exceeded (in bold below)...
    CrystalDecisions.CrystalReports.Engine.InternalException: Failed to open a rowset.
    Details: ADO Error Code: 0x
    Source: Microsoft OLE DB Provider for SQL Server
    Description: Timeout expired
    SQL State: HYT00Error in File J:\DOCUME1\ADMINI1\LOCALS~1\Temp\SpecificationSummaryReport {42EDFEA3-DD0D-4F5E-BC0B-F9CC1126A872}.rpt:
    Failed to open a rowset. ---> System.Runtime.InteropServices.COMException (0x800002D3): Failed to open a rowset.
    Details: ADO Error Code: 0x
    Source: Microsoft OLE DB Provider for SQL Server
    Description: Timeout expired
    SQL State: HYT00Error in File J:\DOCUME1\ADMINI1\LOCALS~1\Temp\SpecificationSummaryReport {42EDFEA3-DD0D-4F5E-BC0B-F9CC1126A872}.rpt:
    Failed to open a rowset.
    1)  Is there a Service Pack for CR 10.5???  That is the runtime that is in use - not XI.
    2)  The report viewer app is in version 10.5 (as mentioned in the first post) but the report was created in the designer for version 11.  Before we assume that is a problem - I have other reports created this way that work fine.
    3)  The data source is SQL 2005.
    4)  The connection type is OLE DB - Microsoft OLE DB provider for SQL Server.
    I think the issue is due to corruption in the report file.  I've seen this many times with reports (over the last 10 years).  I've had reports that refuse to work but if I recreate them from scratch the new report works fine.  In fact, I've recreated the data portion of this report (using the same sprocs) and that one works.

  • Tcp-flow-timeout on outgoing connections

    Hello,
    We have clients connecting to a server, through a CSS.
    The server, on some specific cases, has to connect to the clients (different port).
    Since IP adresses are the same, the connection has to go through the CSS, which in this case is acting as gateway.
    We're facing issues, because of teared down flows at CSS level ; we'd like to change the inactivity timeout, but can't find an easy way.
    So far, the only thing I found, is to set a permanent port, but it's not really the best solution, as connections which were not closed correctly would accumulate in the system.
    Would there be an easy way (I'd prefer to avoid having to create contents) for the outgoing flows, on a specific port, to have a different inactivity timeout than the default one ?
    Thanks in advance for your help.
    Cheers
    Mael

    Hi Mael,
    CSS will not break routed connections just going through it.
    Here's what happens:
    1) CSS gets a packet directed towards an IP which is not configured as VS. When it does, it creates a connection for that flow even if the  packet is not the original SYN of the three way handshake.
    2) If no data is received on this connection for 16 seconds, it is moved to the free-flows list. Once it is there, the CSS will continue to  use the information located in it to forward traffic but the connection will be removed as soon as we need some room for new entries.
    3) Once the connection is removed even from the free-flows list and that we get a new packet for the connection, you got back to point #1.  Since the CSS doesn't check for stateful information (AKA doesn't check if the first packet is a SYN).
    So even if the idle timeout of the connections going through it are 16 seconds, a routed TCP flow through the CSS *will never  time out*.
    For changing inctivity timeouts for loabbalanced connnections you can use the below command which needs to be applied to Content rule/source groups.
    flow-timeout multiplier
    Note: If you give number as 2, CSS will multiply it by 16 and actual timeout would be 32.
    The permanent option is also good one but can be a problem if you have high traffic for that port. You can also use cmd-scheduler along with permanent port to clear the flows periodically.
    Regards,
    Kanwal

  • Cisco 7921 Wireless DCHP Timeout after loosing connection

    Running 7921
    AP 1200 Software Version 12.3(4)JA
    I'm having a problem that after I set the phone up. Everything comes up fine and works great but whenever I hit a deadzone or if it looses connection, the phone will try to configure the IP and then it gives me a DHCP timeout and never connects again. If I reset my TFTP settings it then works again. How can I prevent this?

    Yes per my 7921G Deployment Guide @ http://www.cisco.com/en/US/docs/voice_ip_comm/cuipph/7921g/6_0/english/deployment/guide/7921dply.pdf, you need 12.3(8)JEA or later to run the 7921G phone successfully.
    12.3(8)JEC is ok for the 1230, but would suggest 12.4(3g)JA1 or later for the 1240.
    For static WEP, need to ensure the keys on the AP and the client match. If you have 2 keys where one is tx on key 1 and the other is on key 2, then the other side needs to have the same key to be able to decrypt the packets.

  • Set a timeout for crystal sessions while using the Windows.Forms.Viewer?

    Hi,
    I am looking for a way to set the timeout for the crystal report sessions when using the Windows.Forms.Viewer in a .NET application. I guess that the default value is 20 minutes (like in the entperprise installations) but we cannot afford to keep many sessions open for that long. Is there a registry entry which can be set? Or even a way to do this programmatically?
    Thank you in advance,
    Stratos

    Hi David,
    we are talking here about a standalone .NET application where the reports are installed locally (like the application itself). We are not retrieving the reports from a server. The whole thing was developed using the crystal report viewer model probably because it was easier to do so. Is there a method in this model to tell the crystal runtime to do the clean-up work either for a report (like the ReportDocument.Close() ) or for the entire runtime instance. Dispose() does not seem to help us. If you say that there is no other way than redesign then we have to consider this option also.
    Cheers
    Stratos
    PS: What I was thinking of (as Plan B instead of using the ReportDocument object model) is to instantiate the crystal report viewer object in a separate process (.exe). Please note that we open a new crystal report viewer windows for each report, which is displayed. Closing the viewer window (ie. terminate the process) will at least then clean up and release the crystal DLLs and hopefully close the database connections. Or am I missing something here?
    Edited by: Efstratios Karaivazoglou on Jul 29, 2008 10:05 PM

  • Shorting the timeout for socket connection

    Hi everyone, i've got a client who owns a handle to a remote object. When the remote object quits, accesing it through a method invocation throws a java.net.SocketTimeoutException: Read timed out. That's fair, what's up is that it lasts about six seconds in sending it, and i would like to shorten the time it waits until it realises it can't connect. I've tried with sun.rmi.transport.connectionTimeout and sun.rmi.transport.tcp.readTimeout, and no success. Any idea?
    Thanks in advance.

    The "sun.rmi.transport.proxy.connectTimeout" parameter works only when HTTP is used.
    We do it manually by utilizing RMI client and server socket factories and setting socket options as appropriate. For the connect timeout, there is connect(SocketAddress endpoint, int timeout) method of the Socket class. With this approach, the application has a full control over sockets used by the RMI engine.

Maybe you are looking for

  • How do I get Extensions to Show in PSCC 2014?

    Almost none of my Extensions show in PSCC 2014.  They show as installed and enabled for PSCC 2014 in my Extension Manager.  I have Uninstalled and Reinstalled everything, including PSCC 2014, my Extension Manager, Creative Cloud and my Extensions.  W

  • Set password on memory card and is now corrupt

    I tried setting a password on my memory card, and it just locked up my phone. I waited for ages but eventually just turned the phone off and on again. Now the phone doesn't recognize that there is a memory card at all, and when I plug it into my comp

  • How to do interpolation in oracle

    Hello All, I have minutely level data in the table and I wanted to add these minutely level data for every half an hour and store it seperatly time value eg: 06-apr-2004 10:01:00 10 06-apr-2004 10:02:00 12 06-apr-2004 10:03:00 14 06-apr-2004 10:04:00

  • Hierarchy name missing while uploading!

    Hi, While scheduling info package , in the hierarchy selection tab, i am not seeing any of the hierarchy names . i had created one in maintain hierarchy screen after adding all external characteristics! Am i missing something here? Thanks, Ravi

  • Lost iphone serial number

    my iphone was stolen and i want to know the serial number