Can still write to a closed socket

Hi
When the server closes the socket , my client can still write to the outputStream no exception is thrown (although nothing actually reaches the server - as expected), however when I go to read from the socket I get a SocketException.
This is a problem for me as I rely on the write failing in order restart the socket. This problem only seems to occur on solaris, not windows.
Any help would be appreciated.
Thanks
Paul

Either you are stating your problem incorrectly or you are misinterpreting the results (or something is hideously wrong with your VM and/or IP stack.)
Given the following client code...
    Socket s = ....
    OutputStream os = s.getOutputStream();
    os.write(...);If the server has closed the socket or it no longer exists for any reason, you will get an exception.
Perhaps your problem is actually that, depending on the OS and different factors, you might not get a timeout exception for up to 5 minutes after the initial write?

Similar Messages

  • How can I write in French without being auto-corrected to English?

    Before moving to Canada, I was able to write in French and even had auto-correct in that language, as well as in English. I can't understand why this possibility is now disabled, Canada being - at least in theory - a bilingual country.

    sansouci wrote:
    I was able to write in French and even had auto-correct in that language, as well as in English. I can't understand why this possibility is now disabled
    Surely you can still write in French, right?
    For the spell check, go to system preferences/language & text/text/spelling and set it to French.  In the Pages app, you have to do this in Inspector > Text > More > Language.  In MS Office, you have to use their own settings -- check their Help.

  • How can we write the code for opening the command prompt and closing the

    how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)

    rakeshsikha wrote:
    how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)?

  • Is content viewed during "private browsing" forensically extractable? e.g does it still write the content to the disk and can it be recovered?

    is content viewed during "private browsing" forensically extractable? e.g does it still write the content to the disk and can it be recovered?
    If a forensic investigator was to do forensics on my disk after i browsed content under private browsing, could it be recovered
    There is no intention to use this for illegall purposes, i just wondered how to private is "private browsing"

    Private browsing basically prevents any data from being stored in your Profile folder. [http://support.mozilla.com/en-US/kb/Private%20Browsing This] article provides more details.
    Please note that cookies '''are '''created during a private browsing session. However, they are deleted once the session is ended or when you exit Firefox application.
    Also note that other applications on your computer might be tracking which sites you visit (firewall, antivirus etc). They will still be able to collect your browsing related data even if you have activated private browsing in Firefox.

  • Itunes launches itself and starts playing even when my laptop is closed, but I can still hear it. I can't figure out how to keep it from doing it

    itunes launches itself and starts playing even when my laptop is closed, but I can still hear it. I can't figure out how to keep it from doing that.

    See if a device is attached and "open iTunes when iPod is connected" is selected. https://discussions.apple.com/message/16483979#16483979
    Check for other iTunes preference settings that might cause this.
    Hacks to stop Bluetooth speaker from starting iTunes -
    http://forums.macrumors.com/showpost.php?p=19045335&postcount=4
    LincDavis June 2014 post - https://discussions.apple.com/message/25998941

  • Closed website but can still hear the video feed.

    any idea what could be wrong? I opened QVC and watched something. I closed the web browser but I can still hear the program, its driving me nuts. How do I make it stop?
    Post relates to: HP TouchPad (WiFi)

    When in doubt, reboot!  ;-)
    Most glitches can be solved this way.
    Press and hold both the Power switch and center button for at least 15 seconds.  This will restart the device.
    WyreNut 
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • How can I write a simple proxy server that intercept 80(www)socket???

    Does any body knows how can i write simple proxy server that intercept web sites watching by user???thx

    Does any body knows how can i write simple proxy
    server that intercept web sites watching by user???thxTo be clear a proxy means that requests go to the proxy and then the proxy relays the request to proper place.
    If you want to see traffic without being in the middle (the requests go direct) then you can not use the standard Java API. And do so in any situation of course requires that you be in the physical connection in the first place (ie in a star network with a router in the middle a client machine will not see packets from other machines.)

  • Closing Sockets

    Hi all,
    Im having a big problem with the closing of sockets.
    I have a simple program which handles the sending / receiving and monitoring of HTTP traffic.
    My program has a 'sender' part which opens a socket, writes a request (using the socket output stream), reads the response (using the socket input stream, until read() == -1 ) and then closes the streams and socket.
    The 'receiver' part simply receives socket connections, reads the content (until read() == -1), writes a response, and then closes the streams and socket.
    The monitor part is a simple 'tunnel'. For each received socket connection, a connection is made to a server.
    Two threads then operate like this:
    T1) While read from client != -1, write to server
    T2) While read from server != -1, write to client
    Seems simple enough, and sort of works.
    The problem I have is cleanly closing all sockets without screwing up either the tunnel or a client.
    I try not to close the streams / sockets at the 'logical' times, but for some reason any combination I try results in Socket Closed exceptions during a read in either the tunnel or the client.
    There is a fair amount of code - so I dont expect anyone to wade thru it to find the problem, but Im just wondering if anyone has:
    1) Had similar problems and found a solution
    2) Can point me in the direction for more details on the mechanics and implications of closing socket streams
    The java docs seem very sketchy on this subject!!
    Thanks for your help!

    Thanks for the response (2 dukes for the fast reply - plenty more available on this one though!)....
    Does this mean that there is no 'clean' way to accomplish the transfer task?
    I think both examples will work, but I have a couple of issues:
    This exception is quite normal and indicates that another thread abruptly forced your socket closed or you tried to read or write after closing it yourself. You must catch it.The problem I have with this is that under these circumstances, it is a 'SocketException' which is thrown. The API says that this is thrown if 'there is an error in the underlying protocol, such as a TCP error'. So to be sure I was dealing with the right problem, I'd have to start parsing the exception text looking for "Socket Closed".
    Im keener on option 2:
    providing signalling between your threads Sounds like this is what I need.... Again there is a catch though.
    See, the thread handling the client will be in a blocking read (it will have read everything from the client, and written it to the server. However, as the client socket isn't closed yet, it doesn't know its time to stop). So, Im back to using exceptions again (Im assuming I'd have to do an interrupt?).
    I thought I could get round this on the client side by closing the output stream after writing everything (would signify to the reader thread that all is done).
    This, however, just results in the socket getting closed (my ignorance of the underlying mechanics of sockets showing through here...).
    Further, I want my 'monitor' to work with all request / response based systems - so I cant write a termination sequence on the client side to indicate end of input.
    So - Im really stuck with using exceptions as flags then??

  • Windows7 64-bit causes BEA-000449 Closing socket as no data read

    Hi,
    I have a new Windows7 64-bit laptop and copied my ADF and other FMW apps to the new laptop from my windows XP. I am using Jdev 11.1.1.5 on the prior XP and the new Windows7.
    The applications ran fine in XP and I am able to run the the JSPX pages in the windows7 but for one critical issue.
    I have a page that issues a query to a web service and is able to display the results in a table. The table rows have links to call a managed bean to prepare then uses an Action to display the results in a new form page. The two pages are in an unbounded task flow. When I click on the link I don't see any debug messages from the bean and don't see the Form page but I see in the logs:
    <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:49,319 during the configured idle timeout of 5 secs>
    I never had such issue with XP. (note I used the same Jdev 11.1.1.5 software for both)
    Also I have the same application running on a Linx server and when I tested to click on the link from the result table also I never see the Form page when using Windows7 but works fine with XP !?
    Can we use Windows 7 with ADF and WebCenter applications? This critical since my client users are planning to upgrade to Windows7.
    Is there a special configurations to resolve such issue and others that I still didn't test.
    Thanks

    Update,
    I was using IE 9 on windows7 and IE 8 on XP. I now tested with Firefox 64-bit, which is named Namoroka since that was the 64-bit version I found, and I didn't have such issue, surpised.
    My client must use IE since we also have Siebel which uses ActiveX and many government agencies are certified on IE.
    (Note: when using Namoroka, I keep getting a popup when move from one page to another that: "You are using an unsupported browser. The supported browsers are Interner Explorer 7 and higher, Firefox 2.0.0.2 and higher, Safari 3.1.2 and higher, and Google Chrome 1.0 or higher. )
    From what I see now can't upgrade to windows7, but I did see that many are using it. So please help in what you already solved this issue.
    Thanks

  • Can i write a server for PC  that connects with WIFI?

    hello,
    i need to write a server - client with wifi connection.
    The server will be at the PC and the client is a mobile with android OS. Can i write it in java? if yes can you give a starting point please.
    thanks

    avicohen33 wrote:
    thank's for the answer.
    but i still don't understand how i configure that it's WIFI connection: i just open a socket on the server and the client is trying to connect to the server by its host name, ip by wifi itself. So the server don't care how the connection is established?Right. It doesn't care. You have a client and a server on your local WiFi network. Or maybe the client is in the WiFi and the server is out on the internet. Regardless, you write exactly the same code, and neither the client nor the server knows that there's WiFi involved. Just like when you talk on the phone, you don't know or care if you're talking over fiber or underground cables or above-ground cables or satellite, or some combination, similarly, at all the layers above the Link layer the networking code doesn't know or care what's underneath. Your app just opens a socket connection to an IP address.
    The one case where it gets tricky, but your app still doesn't know the difference, is of the client is on the internet and your server is on your LAN. It has nothing to do with whether the LAN is WiFi, however. It's because you will most likely not have a public IP address, so you'll have to do port forwarding from your router (assuming it actually does have a public IP address, which is common in my experience, but not guaranteed).
    Edited by: jverd on Apr 3, 2010 11:49 AM

  • I just got a new laptop.  How do I install iTunes and set it up so that I can still store my 80 gigs of music on my external hard drive?

    I would also like to set it up so that if I unplug my external hard drive and take my laptop somewhere else, I can still have access to iTunes on said laptop.  I realize that I wouldn't have access to the music that is on my external hd but I can still access the music that I have purchased from iTunes, right?

    If your external drive has the right ports, you should be able to plug it up to your Mac and copy over your photos and wav files. You'll probably (I don't know this for sure as it's been a long, long time since I've dealt with wav files) need to convert the wav files to MP3 or some other format (but I would try opening them directly from iTunes, first - wait a second... yes, iTunes will open wav files).
    There are only a fixed number of ways that Windows drive can be formatted and a Mac can read (though not necessarily write) them all. So you should have no trouble with that.
    Good luck,
    Clinton
    MacBook Pro (15-inch Late 2011), OS Mavericks 10.9.4, 16GB Crucial RAM, Crucial M500 960GB SSD, 27” Apple Thunderbolt Display

  • I can't write to my Drobo

    I have a new iMac (like this):
    I am trying to connect the Drobo that I used to use with my Windows Computer.  It has 4 drives @ 3TB each, and the whole drive is over half full, so I am not terribly interested in the cost that it would take to "back up" that whole disk pack.  It took some shenanigans (reboots of both the drive and the computer; disconnections, and reconnections; fiddling around with MAC Disk Utility) to get it to show up in Finder at all.  I still have issues with it unmounting and needing to remount it, but that's not my main issue.
    THE REAL PROBLEM:
    Though I can get the Drobo to show up in finder, and I can read from it, I can't write to it.  Based on some earlier searching I tried this terminal command, which helped it to show up in finder, but didn't seem to affect it's being read-only:
    new-host-3:~ davidholcomb$ getfileinfo /Volumes/Drobo
    directory: "/Volumes/Drobo"
    attributes: avbstclinmedz
    created: 12/10/2012 19:06:46
    modified: 09/11/2014 03:37:07
    Looking at another thread (partition map check failed because no slices were found), which I wandered into because I was getting this error in Disk Utility upon running Verify Disk because I got a failure when I tried to "mount" the drive in Disk Utility:
    This thread suggested I try a couple additional Terminal Commands, which I will post the results of here:
    #1: diskutil list
    new-host-3:~ davidholcomb$ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *121.3 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:          Apple_CoreStorage                         121.0 GB   disk0s2
       3:                 Apple_Boot Boot OS X               134.2 MB   disk0s3
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *1.0 TB     disk1
       1:                        EFI EFI                     209.7 MB   disk1s1
       2:          Apple_CoreStorage                         999.3 GB   disk1s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk1s3
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                  Apple_HFS Macintosh HD           *1.1 TB     disk2
    /dev/disk4
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *17.6 TB    disk4
       1:       Microsoft Basic Data Drobo                   17.6 TB    disk4s1
    #2 diskutil cs list
    new-host-3:~ davidholcomb$ diskutil cs list
    CoreStorage logical volume groups (1 found)
    |
    +-- Logical Volume Group 7DACBFD5-E22C-404B-98B1-99D97AD08B2F
        =========================================================
        Name:         Macintosh HD
        Status:       Online
        Size:         1120333979648 B (1.1 TB)
        Free Space:   114688 B (114.7 KB)
        |
        +-< Physical Volume F26F7717-B081-4312-8252-65C9E3040AD4
        |   ----------------------------------------------------
        |   Index:    0
        |   Disk:     disk0s2
        |   Status:   Online
        |   Size:     120988852224 B (121.0 GB)
        |
        +-< Physical Volume 414053B5-EFD8-4FC0-87CE-F3913D6E876B
        |   ----------------------------------------------------
        |   Index:    1
        |   Disk:     disk1s2
        |   Status:   Online
        |   Size:     999345127424 B (999.3 GB)
        |
        +-> Logical Volume Family BE5280EF-B093-4137-88A2-5AF3F1ACEFCC
            Encryption Status:       Unlocked
            Encryption Type:         None
            Conversion Status:       NoConversion
            Conversion Direction:    -none-
            Has Encrypted Extents:   No
            Fully Secure:            No
            Passphrase Required:     No
            |
            +-> Logical Volume D35043A0-F886-4223-81DD-4880F04ECEA3
                Disk:                  disk2
                Status:                Online
                Size (Total):          1114146996224 B (1.1 TB)
                Conversion Progress:   -none-
                Revertible:            No
                LV Name:               Macintosh HD
                Volume Name:           Macintosh HD
                Content Hint:          Apple_HFS
    and #3: Mount:
    new-host-3:~ davidholcomb$ mount
    /dev/disk2 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    /dev/disk4s1 on /Volumes/Drobo (ntfs, local, nodev, nosuid, read-only, noowners)
    Another user who had run these commands and posted the results, seemed to have been missing an EFI partition on their external drive and was asked to run this command and post results.  But the thread with that user dies there.  Here are my results of this command:
    new-host-3:~ davidholcomb$ diskutil info disk4
       Device Identifier:        disk4
       Device Node:              /dev/disk4
       Part of Whole:            disk4
       Device / Media Name:      TRUSTED Mass Storage Media
       Volume Name:              Not applicable (no file system)
       Mounted:                  Not applicable (no file system)
       File System:              None
       Content (IOContent):      GUID_partition_scheme
       OS Can Be Installed:      No
       Media Type:               Generic
       Protocol:                 USB
       SMART Status:             Not Supported
       Total Size:               17.6 TB (17592186044416 Bytes) (exactly 34359738368 512-Byte-Units)
       Volume Free Space:        Not applicable (no file system)
       Device Block Size:        512 Bytes
       Read-Only Media:          No
       Read-Only Volume:         Not applicable (no file system)
       Ejectable:                Yes
       Whole:                    Yes
       Internal:                 No
       OS 9 Drivers:             No
       Low Level Format:         Not supported
    Can anyone help me with a next step to make this drive read/writeable?

    Turns out that the Drobo needs to be plugged straight into computer. I had it via hub. Though it has worked for the past couple weeks in this configuration, the new update pushed it over the edge, I guess. Plugged in directly and working fine.

  • I'm unable to write/burn a CD-R (Verbatim) from a playlist after upgrading to iTunes 12.0.1.26. I get error 4000. I can however write/burn a CD from Windows Explorer and CDBurnerXP v4.5.4.5143 – which implies the device is working OK

    I’m unable to write/burn a CD-R (Verbatim) from a playlist after upgrading to iTunes 12.0.1.26. I get error 4000. I can however write/burn a CD from Windows Explorer and CDBurnerXP v4.5.4.5143 – which implies the device is working OK – and only fails when I write from iTunes.  The drivers are up to date
    Microsoft Windows 7 x64 Business Edition Service Pack 1 (Build 7601)
    Dell Inc. Latitude E6420
    iTunes 12.0.1.26
    QuickTime 7.7.6
    FairPlay 2.7.39
    Apple Application Support 3.1
    iPod Updater Library 12.0
    CD Driver 2.2.3.0
    CD Driver DLL 2.1.3.1
    Apple Mobile Device 8.0.5.6
    Apple Mobile Device Driver 1.65.0.0
    Bonjour 3.0.0.10 (333.10)
    Gracenote SDK 3.06.0.2770
    Gracenote MusicID 3.06.0.2770
    Gracenote Submit 3.06.0.2770
    Gracenote DSP 3.06.0.2770
    iTunes Serial Number 756D13C00C3583C8
    Current user is not an administrator.
    The current local date and time is 2015-01-13 14:47:35.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is supported.
    Core Media is supported.
    Video Display Information
    Intel Corporation, Intel(R) HD Graphics Family
    **** External Plug-ins Information ****
    No external plug-ins installed.
    iPodService 12.0.1.26 (x64) is currently running.
    iTunesHelper 12.0.1.26 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.
    **** CD/DVD Drive Tests ****
    LowerFilters: SbCeCd (3.2.6.3),
    UpperFilters: GEARAspiWDM (2.2.3.0),
    F: HL-DT-ST DVD+-RW GU40N, Rev A103
    Drive is empty.
    The last failed audio CD burn had error code 4000(0x00000fa0). It happened on drive F: HL-DT-ST DVD+-RW GU40N on CDR media at speed 24X.
    F: HL-DT-ST DVD+-RW GU40N, Rev A103
    Audio CD in drive.
    Failed Reading table of contents, error 4000.
    Check the website of your computer or drive manufacturer to verify that you have the latest firmware for your CD / DVD drive.
    Audio CD reading failed. Error Code:   87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87.
    iTunes cannot play or import music from a CD in this drive. The drive may need a firmware update. Check with the manufacturer.
    Get drive speed failed. Error Code: 4000.
    The last failed audio CD burn had error code 4000(0x00000fa0). It happened on drive F: HL-DT-ST DVD+-RW GU40N on CDR media at speed 24X.

    Hi iTunes-1,
    Welcome to the Support Communities!  The error message you posted indicates a possible firmware update is needed for iTunes for Windows to work with your CD drive.  
    iTunes for Windows: Updating the firmware on your CD or DVD drive - Apple Support
    http://support.apple.com/en-us/HT201852
    Having outdated firmware can cause issues using CDs and DVDs with iTunes for Windows. Firmware is a type of software stored in a chip in hardware that can sometimes be updated.Identifying drives and firmware versions
    To run CD Diagnostics, follow the steps in this document.
    After following the steps to run CD Diagnostics linked above, look at section three to find out more about your optical drive(s).
    Here is an example of what section three might look like:
    In this example there are two drives. Drive E is a Samsung DVD-ROM drive with a model designation of SD-616 that has firmware version F000. Drive F is an NEC drive with a model designation of NR-7900A that has firmware version 1.08.Updating the firmware
    If the optical drive you are using came with your computer, check with the support site for your computer for a firmware update. Typically you will need to go to the support website for the computer maker and click on a "downloads" or "updates" link, and then enter your computer model designation and operating system version to see what updates are available. Then look through the available updates for a firmware update for your optical drive. Download the updater and run it. If you need assistance applying the update, contact the maker of your computer.
    If the optical drive you are using came as a separate part (was not included with a computer), check the support site for the drive maker for a firmware update. Sometimes the manufacturer is not clear in the CD Diagnostics results. In that case, you may just have to search the Internet for the drive model designation. You can usually find out who made the drive by looking through the results of such a search. Once you have identified who made your drive, go to the support website for that company. Look for a "downloads" or "updates" link, and then enter your optical drive model designation. Download the updater and run it. If you need assistance applying the update, contact the maker of the optical drive.Verifying that the firmware was updated
    Run CD Diagnostics again.
    Examine the CD Diagnostics results. The firmware version for the drive should be the new version.
    Information about products not manufactured by Apple, or independent websites not controlled or tested by Apple, is provided without recommendation or endorsement. Apple assumes no responsibility with regard to the selection, performance, or use of third-party websites or products. Apple makes no representations regarding third-party website accuracy or reliability. Risks are inherent in the use of the Internet. Contact the vendor for additional information.
    Last Modified: Nov 8, 2014
    Also, you mentioned that you have been successful burning a CD with the Windows OS.  Make sure that you have closed all software programs that can access the CD burner so that there isn't a conflict for the drive.   Sometimes chaning the burn speed from "maximum" to 8x can also help in this situation.
    I hope this information helps ...
    - Judy

  • How to tell embedded jinitator applet is still running when window closed

    Hello, we are trying to accomplish the same thing that is mentioned in this post from Metalink. I've searched for a solution and hope someone here can help. Instead of restating the issue I think David Wilson does a good job of explaining what is needed. Can anyone please suggest a possible solution?
    From: David Wilton 07-Oct-05 01:08
    Subject: How to tell embedded jinitator applet is still running when window closed
    How to tell embedded jinitator applet is still running when window closed
    Hi,
    We run an oracle 10g forms application through 9iAS over an intranet. All users are running windows 2000 professional.
    We run separate frame = true but I would like to switch to separate frame = false
    With separate frame = true if the user clicks the outer windows "X" close button (forms mdi window) the user is prompted to save changes before the application ends.
    BUT
    when using separate frame = false
    If the user clicks the upper window "X" button (no longer form mdi window but regular browser window) the window and application is abruptly closed.
    I'm interested in using a onbeforeunload function to confirm if the user wants to close the window. This would be placed in the basejini.htm file. This could always ask if the user wants to exit or not. If they click OK then the window closes but if they click "Cancel" you are returned to the forms application exactly where you left. something like event.returnvalue="do you really want to exit?";
    However if the user exited using the normal exit form method then the applet is already closed before the onbeforeunoad event fires and there is nothing to go back to and I want the window to close automatically. This is accomplished using close.html file in post forms trigger.
    So what I want and what I think many may also want is the check if the embedded applet is still running and if so prompt the user to return to the application or continue to close. Of course If the applet is no longer running then just close because there is no reason confirm closing anymore.
    Does anyone have a html/JavaScript solution that can be placed in the jinitiator.htm file? or similar?
    Thank you
    David
    [email protected]
    From: Andrew Lenton 07-Oct-05 08:58
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I don't know if this is exactly what you are after but you can add the following to the top of your basejini.htm file and it should prompt the user before exiting the IE window.
    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%
    <SCRIPT>
    <!--
    window.onbeforeunload = unloadApplet;
    function unloadApplet(){
    message = "Warning! Please exit the Java Applet prior to
    exiting the browser"
    return message;
    //-->
    </SCRIPT>
    From: Oracle, mohammed pasha 07-Oct-05 09:55
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    David,
    Well I could not understand your complete requirement.
    Refer to Note.201481.1 How to Close the Browser Window When Closing Forms And How to Simulate SeparateFrame By Javascript
    Note.115905.1 How to Close Browser Window When Closing Webforms Applet
    Kind Regards,
    Anwar
    From: David Wilton 07-Oct-05 14:37
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Thank you for your reply and yes you did not understand my question fully.
    Sorry if this is a long reply
    I am able to close the browser window using information in notes 115905.1 and 201481.1, this is not the issue. We implemented this several years ago. It is workable for both separate frame = true or false.
    It is most important to not allow the user to end their forms application by closing the windows browser, they must close using normal form exit commands.
    What I want is to have separate frame = false, the big drawback to this option is the user can exit the application and bypass all forms code by pressing the windows "X" close button. This is why we need the code as just provided by Andrew Lenton above in this thread.
    BUT Andrew's code will always prompt the user before closing the window and I do not want that. I want the user to be prompted only under scenario 2 listed below.
    Here's the 2 case scenario for exiting the application.
    1. If the user closes properly and uses exit form which fires all normal form triggers including post_form with it's call to close.html file.
    All uncommitted changes are saved or rollback and the users session is ended normally both on the database and in the application server.
    All browser windows will close, great all is good. And without Andrew's code the window will close but with Andrew's code the user will be prompted to close or not, if they select Cancel the window will remain but the applet has already ended so why prompt? ...This is what I want to avoid.
    2. In the forms app. if the user clicks the windows "X" close button with uncommitted changes. The browser just closes the changes are rollback without prompting the user to save. The users sessions are now lost and still running in the database and application server until they are timed out.
    If I use Andrew's code then the user will be prompted to continue to close or go back, if they click Cancel to go back then focus returns to the forms application and the user can continue to work. If the user clicks OK then the window closes and unfortunately their sessions are still lost until timed out.
    So what I desire is to add to Andrew's code to check if the embedded applet is still running and prompt the user to close or not accordingly.
    Something like:
    Basejini.htm like
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function maximizeWindow()
    window.moveTo(0,0);
    window.resizeTo(screen.availWidth,screen.availHeight);
    function confirm(){
    If(document.embeddedapplet.closed())
    Win.opener = self;
    win.close();
    Else if
    event.returnValue = "Closing Forms Application. OK to continue?";
    </SCRIPT>
    <BODY %HTMLbodyAttrs%, onload="maximizeWindow()", onbeforeunload="confirm()">
    %HTMLbeforeForm%
    I hope this explains my requirements.
    David
    From: Oracle, Evelene Raechel 10-Oct-05 06:45
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Hi,
    Note.199928.1 How to Alert User on Closing Client's Browser Window in Webforms
    Regards,
    Rachel
    From: David Wilton 11-Oct-05 17:40
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I'm sorry this is not helpful at all.
    Note 199928.1 is only an alert which does not stop the closing of the window and still displays as an alert if the user does close properly using exit form ... so why would you want to display the alert then?
    This is exaclty what I do not want and why I want to determine if the applet is still running before displaying any kind of message.
    David
    From: Oracle, Evelene Raechel 17-Oct-05 12:23
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Closing thread.
    Thanks,

    Hello,
    I had the same issue last year - wanting to provide a warning on closing the browser, but only if the Forms session is still running. The approach I took is described below, see also the thread where I originally posted this at Closing brower window
    Hi there,I've had a similar requirement - or rather, the two conflicting requirements: to warn when the browser is being closed, but for the app to be able to close the browser without a warning being fired.
    To always provide a warning when someone (the user or the Forms app) tries to go to a different page (e.g. your close.htm), use Javascript like:
    function confirmExit(){
    if(appletRunning==true) {
    msg="Closing this window or navigating to another page will end your SomeGreatApp session.";
    window.event.returnValue=msg;
    And make a call to confirmExit() in the onBeforeUnload event of your main page.
    You'll notice I first check an 'appletRunning' variable before displaying the warning. This Javascript variable is set to true by my app when it starts up, using an embedded Javabean that calls out to Javascript. Once that variable is set to true, then the warning will be displayed if the user tries to shut the browser by clicking on the 'x' button, or to go to a different URL.
    When my app is shutting down, it uses the same Javabean to set appletRunning back to false. It then navigates to a close.htm - which will be done without a warning being displayed.
    See Re: How can a Javabean call Javascript function of the basejpi.html?? for example code on how to call Javascript from a bean embedded in your Forms app.
    Hope these ideas help you out, it's worked for me (so far, anyway!!)
    James

  • How can I write a program that compiles without warnings?

    I tried the following with the 1.5 beta-compiler (build 28; I think):
    class Y {
         public static final class Pair<X,Y> {
           private X fst;
           private Y snd;
           public Pair(X fst, Y snd) {this.fst=fst; this.snd=snd;}
           public X getFirst() { return fst; }
           public Y getSecond() { return snd; }
           public String toString() { return "("+fst+","+snd+")"; }
      public static void main(String... args) {
         Pair[] pairArr = new Pair[10];              // supposed to be an array of Pair<Integer,Integer>
         for (int i=0; i<pairArr.length; i++)
             pairArr[i] = new Pair<Integer,Integer>(i,i);
         for (int i=0; i<pairArr.length; i++) {
             Pair<Integer,Integer> p = pairArr; // unchecked warning
         System.out.println(p);
         Integer first = p.getFirst();
         Integer second = p.getSecond();
    // ... more stuff ...
    It turns out that I get an unchecked warning when I extract an element from the array of pairs. Okay, that's fine. How can I avoid the warning? I had expected that an explicit cast would help.
      Pair<Integer,Integer> p = (Pair<Integer,Integer> )pairArr;
    With a cast I'm telling the compiler: "I _know_ what I'm doing; please trust me." But the compiler still issues a warning.
    How can I write a warning-free program in this case? The only thing I can think of, is not using the parameterized type Pair in its parameterized form. But it's not the idea of Java Generics that I refrain from using parameterized types. What am I missing?

    It turns out that I get an unchecked warning when I
    extract an element from the array of pairs. Okay,
    that's fine. How can I avoid the warning? I had
    expected that an explicit cast would help.
    Pair<Integer,Integer> p = (Pair<Integer,Integer>
    )pairArr;
    With a cast I'm telling the compiler: "I _know_ what
    I'm doing; please trust me."  But the compiler still
    issues a warning.  Yes, but at least you were able to change the warning from "unchecked assignment" to "unchecked cast" which is a little shorter ;-)
    Seriously , since arrays of generic types are disallowed, there is probably no way to get rid of these warnings - which makes a strong point for eliminating "unchecked" warnings altogether (see the other thread "selectively suppressing compiler warnings")
    Cheerio,
    Gernot

Maybe you are looking for