HTTP Persistent Connection - Cannot Change Timeout

On an HTTP persistent connection, the client and server both can have timeouts on a connection. In the case of a Java client, I can find no way to set the client's timeout value. It is always 5 seconds (assuming you exactly jump through the hoops necessary to get it to work at all). According to my reading of decompiled code, this will be the case unless it is a proxy connection, in which case 10 seconds will be used.
For a client-server app, the best performance occurs if the connection is truly persistent - as long as the server has resources. This means one wants to minimize or eliminate reconnections. But the Java implementation appears to always drop the connection after the 5 or 10 second limit.
Has anybody gotten around this? All of this logic and parameters are deep into sun.net classes, so I can't get at them by subclassing... and the only factories I can find to override require essentially rewriting the stuff I gain by using the URL/HttpURLConnection framework in the first place.
NOTE... because the persistent connection transparently hides the persistence, you can only tell how it is working if you have a packet monitor.
I use ethereal (open source) on Windows to do this.It can be found at http://www.ethereal.com/
For more details: http://www.tinyvital.com/JavaHTTPProblem.html
Thanks!

I also have been surfing the web to find out how to implement
an applet-to-servlet communication link over a persistent http connection.
There is a working implementation available for download at
http://www.ustobe.com/
After clicking on the 'news' item in the menu, there are links
available to download HttpKeepalive.java, with javadoc explaining
how to use this class.
Mike

Similar Messages

  • How to get and maintain Http persistent connection to get pushed data from

    At MangoSpring ,www.mangospring.com we are working on application which uses IMPS protocol where we always required to receive data pushed by server.
    To achive this we'll have to maintain one persistent Http connection on client side, so that we can be notified whenever some data is pushed by server.
    Reply With Quote

    our problem is :: " How to get and maintain Http persistent connection to get pushed data from Server "

  • Http persistent connection, several request-response same http connection??

    -I have a problem: I need to make a sever side java application to comunicate over http/1.1 using persistent connections, in other words: A http client sends an httpRequest to my application, my application receives the request and then sends a response, the httpClient receives the response and sends a second http Request to the application, the application receives this second request over the same connection and sends a second response to the client. All these things would be made over the same connection without closing any socket.
    I`m trying to made this for 3 weeks but when the server side application responses the first request, the connection closes.
    Anybody can help please???
    I don�t speak english very well, sorry!!!!

    HTTP has a connection-keep alive feature. If you are using a standard api for HTTP communication and a standard HTTP server you will have this feature enabled already. But it is not good idea to depend on connection keep alive feature because HTTP is not designed to keep track of the state of session on its own.
    Why do you want to have it that way?. Cant you implement same requirement using HTTP sessions/cookies

  • HTTP persistent connection (keep Alive) problem

    Hi,
    I'm trying to deploy a RPC web service and I would like to use the HTTP 1.1 keep alive feature (which should be the default).
    I generated the server side and client side code using jdev 903. The AS is OC4j 903.
    The problem is that the server is sending a ‘Connection: close:’ header in the SOAP response, despite the client sending a ‘Connection: keep-alive’ header in the request. This is obviously causing the client to close the connection and open another for the next message.
    The documentation implies that the server will always try to use persistent connections, even so, in the file:
    <OC4J_HOME>/j2ee/home/config/http-web-site.xml
    there is a config option ‘use-keep-alives’. Setting this to true has no effect.
    I’m guessing there must be another option somewhere to turn on connection persistence.
    Can anyone please help ?

    Does anyone know whether Oracle Supports persistent connections ?
    I tested this on JBOSS and I seems to get better performance.
    cheers.

  • HTTP persistent connection

    Hello,
    I know this subject has already been touched but I did not manage to find a practical solution.
    I would like to send more than one http request (and check the response) to the same URL without having to reopen a new HttpURLConnection each time. The following piece of code does not seem to give any error but the server does not seem to receive more than one request. Could you give me any help ??
    Thanks,
    Francesco.
    public void exec() {
    try {
    url = new java.net.URL(m_hostURL);
    connection = (java.net.HttpURLConnection)url.openConnection();
    connection.setRequestProperty("connection", "Keep-Alive");
    //set the output to true
    connection.setDoOutput(true);
    out = new java.io.OutputStreamWriter(connection.getOutputStream(), "ASCII");
    for (int i=1; i<= 10; i++) {
    //place request in output stream
    out.write("hello world!!");
    out.flush();
    //send request and receive response code
    System.out.println(" Code : " + connection.getResponseCode());
    out.close();
    connection.disconnect();
    } catch (Exception e) {
    System.err.println("ERROR: Failed to send to URL - " + m_hostURL);
    e.printStackTrace();

    I also have been surfing the web to find out how to implement
    an applet-to-servlet communication link over a persistent http connection.
    There is a working implementation available for download at
    http://www.ustobe.com/
    After clicking on the 'news' item in the menu, there are links
    available to download HttpKeepalive.java, with javadoc explaining
    how to use this class.
    Mike

  • How do i change http max connections, http persistent, pipling to true, and proxy pipling to true

    how do i change http max connections, http max persistent, pipling to true, proxy pipling to true.

    Simpler question: Can I change the max connections in Flex?
    Thank you.

  • Network.http.max-persistent-connections-per-server keeps reverting to user set 4

    I didn't used to have this problem as far as I'm aware, but as of recently, I've noticed that if I try to download more than 4 of one thing at a time from the same site, it would fail. For instance, if I have up 5 web pages of streaming content, only 4 will load, the other 5th one will do nothing until I finish one of the others. Upon looking up some information on this, I saw that the network.http.max-persistent-connections-per-server is set at "user set = 4", and if I change that number to anything else, it corresponds. If I click to 'reset' the number, it goes to the default of 6 - which is still less than what it used to be. I used to not even have a limit on this as far as I'm aware, or if I did, it was well beyond 10 and that wasn't a product of me manipulating it.
    What I'm asking is this:
    1) How do I make this so it permanently switches to a higher number? Every time I reset it to 6 or I manually change the number to something higher, once I close it, those settings go back to 4.
    2) Why is it reverting and not staying the way I change it?
    3) What's the purpose of this and why is it just recently doing it when I haven't put any new add-ons or made any other refinements to Firefox that I'm aware of?
    Any help would be appreciated

    Two possible causes for it resetting to 4 that I can think of.
    # You have an add-on handing that pref and that is resetting it to 4 when Firefox is restarted.
    # That pref is set via user.js and that causes it to go to that value as Firefox starts.
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes <br />
    http://kb.mozillazine.org/User.js_file

  • Cannot get a connection, pool error Timeout waiting for idle object

    my connection pool setting is
      maxActive="3" minIdle="2"                maxWait="10000"              removeAbandoed="true" logAbandoned="true"         removeAbandonedTimeout="30"         autoreconnection="true" 
    we have 7 people hitting the group of search functions ,
    about 3 minutes I get
    I got error like
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object         at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)         at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)         at Deferment.showResult.checStudent(showResult.java:135)         at Deferment.showResult.doPost(showResult.java:99)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:402)         at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    I just wonder
    1) Cannot get a connection, pool error Timeout waiting for idle object-> cause by connection pool leaking or other problem.
    2) Setting the maxactive to -1 ( suggestion from Google) , if I set my connection to ulimit , waht should I put on minIdle="2"
    3) How can I test my connection pool have problem or not ? is
    SHOW PROCESSLIST; tolding me someinformation? I use Mysql
    Thank you!

    I try something like ps2 = conn.prepareStatement(target);
                ps2.setString(1, UNumber); // set input parameter
                rs = ps2.executeQuery();
                sendMail = 0;//how many rows we can find.
                while (rs.next()) {
                    sendMail++;
                ps2.close();
                rs.close();
                conn.close();
      if ((count1 == 0) || (count2 == 0)) {
                    conn.rollback();
                } else {
                    conn.commit();
                    conn.setAutoCommit(true);
                ps.close();
                calstat2.close();
                conn.close();
    calstat = (CallableStatement) conn.prepareCall("{call findStudent}");
                calstat.executeQuery();
                calstat.close();
                conn.close();is that enought? what else I should do to make sure I did close all the connection, after I use it ?
    thank you

  • HTTP/1.1 Persistent Connections Revisited!

    Persistent Connections Revisited!
    There have been many posts on this subject but no real answers, but I have narrowed the problem to some extent.
    Problem: Open a connection using a URL and keep the socket open so it can be reused. This is especially important for HTTPS connections.
    What works: The following simple code works from an applications. It will open a single socket to www.xyz.com:1234 and reuse it to do all three operations.
    What doesn�t work: If this code is used in a signed applet running java plugin 1.4.0 under I.E it will open three separate connections and hold them open but not re-use them.
    Same code but it doesn�t work where you really need it to.
    If anyone has any real answer to this PLEASE HELP!
    Code snippet:
    URL base = new URL("http://www.xyz.com:1234/");
    // Do a get
    System.out.println("Doing GET");
    URL url = new URL(base,"index.html");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    BufferedInputStream in = new BufferedInputStream(con.getInputStream());
    int c;
    while((c = in.read()) != -1) {
    System.out.print((char) c);
    in.close();
    // Do a post
    System.out.println("Doing POST");
    con = (HttpURLConnection) url.openConnection();
    con.setDoOutput(true);
    byte[] somedata = "xyz=1234\n".getBytes();
    con.setRequestProperty("Content-Length",new Integer(somedata.length).toString());
    BufferedOutputStream bo = new BufferedOutputStream(con.getOutputStream());
    bo.write(somedata);
    in = new BufferedInputStream(con.getInputStream());
    while((c = in.read()) != -1) {
    System.out.print((char) c);
    in.close();
    // Do a get of an image.
    System.out.println("Doing Get image");
    url = new URL(base,"TestImage.gif");
    in = new BufferedInputStream(url.openConnection().getInputStream());
    int sz=0;
    while((c = in.read()) != -1)
    sz++;
    System.out.println("image size = "+sz);
    in.close();

    More Info:
    Upgraded to Java Plugin 1.4.1_01. This made matters worse. Now the last "GET" actually does two "GETs" creating two sockets. I have no clue as to what's up with that! Either SUN has some real serious bugs or I'm totally lost.
    Somebody please give my a hand here, it looks like my ship is sinking fast.

  • Persistent HTTPS/SSL connections

    Dear all,
    Does anybody know how to make an HTTPS/SSL connection persistent.
    We need to make multiple HTTPS requests to a server and we found that most of the time it gets new SSL session ID and makes all the master-secret processing whenever it gets the enw session ID.
    I have seen (with -Djavax.net.debug=ssl option) that the JSSE tries to resume, but the server sends new session id, do I need to set/force anything from my side?
    Thanks in advance for the answer!
    Vijay

    We have solved the problem!
    For those who wish to know what happened
    I have done some debugging with the JRE option -Djavax.net.debug=ssl and I could see the JSSE libraries (1.0.2, with JDK 1.3.1) trying to resume the seesion with the SSL session ID which it got from previous communication, however, the server gave a new session ID back and it had to do all the compautations for the secret exchanges from scratch.
    Then we found the load balancer transfers each requests to different servers causing the creation of new session IDs. The problem is solved after making our requests "sticky" to the load balancer and the SSL accelerator.

  • On connecting my iPod NANO to iTunes the music list of songs is FADED  I cannot change of listen to except through the earphones.

    on connecting my iPod NANO to iTunes the music list of songs is FADED  I cannot change or listen to the music except through the earphones.

    Was it ever in this iTunes library?
    What happens when you try to redownload it via:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    What happens when you try to sync?
    If the songs are not in your iTunes library how do y expect them to sync to the iPod?
    Was the iPod previous synced to another iTunes library/computer?
    Have you successfully synced from this iTunes library/computer before?
    Do you have the right boxes checked to sync?
    iTunes: Syncing media content to iOS devices and iPod        
    Try syncing using the manual method

  • Cannot change http port

    Hi guys,
    I am trying to change the http port permanently to port 8000. Therefore I go to RZ10 -> select SID_DVEBMGS00_XXXXX -> Extended maintenance -> Display -> Edit -> Create -> and I add
    Parameter name:
    icm/server_port_0
    Parameter val:
    PROT=HTTP, PORT=8000
    Then I press twice Copy and activate the profile. After that I restart the system.
    Now when I go back to RZ10 -> select SID_DVEBMGS00_XXXXX I can not see the icm/server_port_0 entry in the parameter list. It should be here right?
    Also when I go to transaction SMICM -> GOTO -> Services the HTTP Protocol is 0 and not 8000.
    What am I doing wrong?
    Thanks
    Goluef

    Hi Mate,
    Before doing edit I would rather request you to import the active profiles first as changes done in older one will certainly not reflect.
    Utilities >> Import Profiles >> Of active servers
    Then choose the instance profile..Check if already there any entry of icm/server_port_0 and if not then create it or add a new one as icm/server_port_1 or similar
    Then Copy the change>> Save>> Activate or Save and Activate.
    Restart the system and the change should be there for sure..
    If still doesn't work - Check the permissions in filesystem of this profiles and if the SIDadm is able to write the files. The data won't get written until you save it. Might want to check SM21 for errors.
    Alternately for the time being just goto SMICM >> Goto >> Services >> Change the HTTP service here
    Services >> Change
    Put  - Port - 8000, Log (HTTP), Keep alive, Process time and Save it.
    Do note this is temporary and restarting system/ICM will make it go.
    Do mind the port 8000 should not be used by any other process/prog.
    Cheers,

  • Java.io.IOException: Persistent connection dropped

    Hi all,
    I am currently testing my midlet that uses a HTTP connection to link to a server using the emulator. However, I keep getting the following exception about a minute after the connection is established:
    java.io.IOException: Persistent connection dropped after first chunk sent, cannot retry
    at com.sun.midp.io.j2me.http.Protocol.sendRequest(+102)
    at com.sun.midp.io.j2me.http.Protocol.sendRequest(+6)
    at com.sun.midp.io.j2me.http.Protocol.closeOutputStream(+4 )
    at com.sun.midp.io.BaseOutputStream.close(+14)
    at java.io.DataOutputStream.close(+7)
    at Conn.sendData(+25)
    at Conn.doPost(+17)
    at Conn.upload(+4)
    at UploadThread.run(+7)
    Here is the code for my sendData() method
    public static void sendData( HttpConnection connection, String data ) throws IOException
         byte[ ] dataOut = data.getBytes();
         DataOutputStream os = connection.openDataOutputStream();
            try
              os.write( dataOut );
              os.flush();
         finally
              os.close();
    }Any help or suggestions as to why I am getting this exception would be greatly appreciated.

    Should i use a persistent connection and could you try to explain what the
    exception actually means?I just thought that the connection may be dropped somehow (maybe a timeout) and it may be related to closing OutputStream you obtain from the connection.
    Every time i send data i create a new thread that opens up a new connection
    and sends the data and receives the response.
    I does this as i am only sending and receiving very small amounts of data. I am thinking that there can be a better design for your application. Is it possible?
    1. If you are using the same connection (i mean socket connection not output)
    why do you close the OutputStream after sending each data. As far as i know flush does this already.
    So why dont you close both the connection and the OutputStream when the job of your program ends.
    2. If you are not using the same connection for each thread, (aagain) why dont you open and close both the connection and the OutputStream in your finally block of your thread?
    Regards.

  • Persistent Connections in Web Services

    Hi, i'm currently developing a Web Service Client that wold be constantly sending requrements to a Web Service server, but i see that the tcp connection is being closed after each requirement is fullfilled. I can't find the way to set the connection as persistent. I tryed forcing the HTTP headers with a code like this one:
    var service:WebService = new WebService("http://127.0.0.1:8080/SomeService.asmx?wsdl");
    var header:Object=new Object();
    header["Keep-Alive"]= "300";
    header["Connection"]= "keep-alive";
    service.httpHeaders= header;
    service.loadWSDL();
    But i get the Fault Event with error string:
    RPC Fault faultString="Error #2096: The HTTP request header Keep-Alive cannot be set via ActionScript."
    if i change the order the error is:
    RPC Fault faultString="Error #2096: The HTTP request header Connection cannot be set via ActionScript."
    Does any one knows how to deal with this?
    Thanks in advance!!!

    With JAX-WS and JAX-RPC , yes.

  • Hi i cannot change the brightness on my late 2011 macbook pro.

    Hi i cannot change the brightness on my late 2011 macbook pro. It is stuck on the lowest level in which i can't view the screen without a flash light. Please i need help how to solve this. I was on my computer when i checked the back which it was really dusty, i tried unscrewing the bottom however some screws were too tight so i took it upon myself and got a rod and startedremoving the dust off the vents and i may have clicked something as i closed the lid on the macbook i could hear the sounds still from the film but the lid was closed as i opened it back up the brightness was on low but sounds were still playing. All the buttons work , all of the F keys, apart from the brightnes keys. I can shine a tourch on the screen and see the display but the brightness will not change but i can see when i click the brightness it says it changes. I have connected it to a spare tv i have via hdmi and i really need help as this is my primary computer and i need it for work when going away. Thank you

    Try SMC and PRAM resets:
    http://support.apple.com/kb/ht3964
    http://support.apple.com/kb/ht1379
    Ciao.

Maybe you are looking for

  • Can no longer play cd's or DVD's or use the D: drive

    I've tried several different CD's, DVD's and a Blackberry Desktop CD install. The drive starts to turn, then stops. Windows Media Player will not play the firs two and nothing happens with the third. I've tried to reinstall drivers to no avail. I've

  • How to Recover Playlists when Transferring iTunes Library from External Drive to New Computer

    iTunes library copied to external drive and then loaded to new computer. All songs are there but all of the playlists that I had set up do not appear. I cannot figure out how to retrieve/recover them. The back-up was not done by me so I'm not sure of

  • Oracle 9i installtion problen on RH21AS 2.4.9-e.3

    Hi, I am installing Oracle 9i cluster on RH21AS kernel version 2.4.9-e.3. Using the doc "Tips to install oracle 9i on RH21AS" I have installed my OS configured it to install oracle. I could get Oracle cluster manager installed and started (using watc

  • Validation on Execution of workitem

    Hi all,        I have  a scenario in which  a workitem with expense value 7000$ has  gone  for approval to manager1 in his UWL. Manager1 can approve expense upto 10000$ But when this  workitem  was  created Manager1 has  gone  on leave and  he has  s

  • Workflow approval appropriation request

    Hi guru, is it possible to creta a workflow for approval appropriation request based on amount of the investment? For example: if amount of appropriation request is less of 100k euro then approver is A if amount of appropriation request is more of 10