Detecting OCI disconnect

What is the best way to detect if your OCI database connection has been lost.
I guess that I could create a thread that runs repeated "select * from dual" or something like that in the background in order to detect a disconnect but I was hoping that there is some better way do this.
Something more like OCIRegisterCallbackfunc(OCI_ATTR_TYPE_DISCONNECTNOTIFY,CallbackFunc).
regards
/N

But theese functionalities requires that the listener works ok?! If the database machine, for instance, had an power outage and rebooted then I wont get any notification?
Register for database startup: I assume that you mean a controlled startup of hte instance, not a startup after a reboot of the db-machine. Am I correct?
Regards
/I

Similar Messages

  • ServerSocket does not detect a disconnected client

    Hi,
    I have created a serverscoket, which will accept 'n' number of clients and send data to all the connected clients.
    And the server should detect when any client goes down or disconnected from network and give the appropriate message to the use that this particluar client has got disconnected.
    I'm able to detect the disconnected client, when the client application is shut down properly (and the application closes the socket). But while the application is running, when the network card is unplugged, then my server is not able to detect this connection loss, and it continues to send the data to the client without throwing any exception.
    Any help would really be greatly appreciated.
    Thanks,
    Hema

    I Asume you don't mean the ServerSocket but the Socket the ServerSocket accepted, for this Socket you can try using
    acceptedSocket.setKeepAlive (true);This may speed up the disconnection detection depending on the implementation of the keepalive mechanism.
    But it then may be that the connection will be terminated, although the connection is only very slow.
    You have to test out, what is better for your purpose.

  • Detecting client disconnects

    What's the best way to detect a client loss of connection? I've heard
    you can register for weblogic.accounting.disconnect events or used the
    workspace destroyMonitor method. Which is preferred? The events method
    concerns me because I don't believe it will be supported in the future
    once JMS takes a foothold. Is this a valid concern? Are there any new
    ways to do this?
    thanks,
    Edwin

    I would suggest you try catching java.net.SocketException (Connection reset
              by peer: socket write error) in you doGet/doPost method. This is not a sure
              way though ...
              --- Igor Zavialov
              "Dylan Taffe" <[email protected]> wrote in message
              news:3a5393d6$[email protected]..
              > Does anyone know of a way to detect client disconnects with servlets?
              Does
              > the contextEventListener or any other event listener get called when a
              > clients kills its connection with the weblogic server?
              >
              >
              

  • RMI detect client disconnect

    Hello, I want to detect when a network disconnect occurs. I implemented a TimerTask that checks every X seconds if the remote object is still bound in the registry, by doing a Naming.lookup(). When I unplug the cable of my computer (to simulate the disconnect), the Naming.lookup() just seems to hang, there is no response... When I plug in the cable again, then I get a response, but this is not the idea... Is there a way to set a timeout or something on this method call?
    thanks

    When I was toying around with chat servers using the RMI Technology, I would have the server keep a vector of RMI Clients (almost like the registry). Then when I went to send a message, I would try to cast the Vector element into the correct type of a client and write the message. If an exception was thrown, I knew the client was not connected any longer and I removed the client from the vector. This approach I have since seen in a lot of documentation on chat servers.
    I haven't tried this but you may try calling the Naming.list () and comparing the values to see if you find a match.
    Hope this helps

  • Detect Client Disconnect When using RTMP

    Hello,
    I hava a Java Server and Clients using RTMP. I've read somewhere that I can detect instantly client disconnection when using RTMP. However I cannot find an example code (in Java) that demonstrates this functionality? Can you help me please?

    I am not sure how your client looks, however the lient connect using NetConnection under the hood which spits NetStatusEvents's and you can listen to them ...
    C

  • Detect client disconnection

    Hi.
    My Java Web Service works with ComPorts so I need to close it in a right way when a client disconnects.
    Is there a way to detect in the Web Service when a client disconnects.
    Thank�s you all!!

    So, i want to be able to find out if the client is disconnected without waiting to send or receive data.Use a read timeout.
    how can i change the value of SO_KEEPALIVEYou can't. It is two hours by default and requires privilege to change it, and changing it is system-wide. So you don't want to do that.
    Use a read timeout. Socket.setSoTimeout().

  • Detecting socket disconnections

    Hi!
    Im using a ServerSocket to enable clients to connect to my
    application. The communication over the returned Socket works
    fine, but I cannot detect when the client disconnects. The
    socket is put on a CLOSE_WAIT state, and according to socket
    sources this means that the client is expecting the final last
    ack (LAST_ACK) from me. The LAST_ACK is sent if I close() the
    socket.
    The problem is that I cannot detect disconnection in my app without
    actually trying to send some "garbage" data on the socket.
    I then get an exception, of course. Is there any clean way
    to implement this?
    Thanks!
    Regards,
    Lars Ove Claesson

    Hi!
    Im using a ServerSocket to enable clients to connect to my
    application. The communication over the returned Socket works
    fine, but I cannot detect when the client disconnects.
    The socket is put on a CLOSE_WAIT state, and according to
    socket sources this means that the client is expecting the
    final last ack (LAST_ACK) from me. The LAST_ACK is sent if I
    close() the socket.Not exactly although the result is the same.
    The server is in the CLOSE_WAIT state. That means that the application is supposed to close the socket. Once it does it sends a FIN to the client and then moves to the LAST_ACK state (waiting for the client to ACK the FIN.) The client of course would be waiting for the FIN.
    >
    The problem is that I cannot detect disconnection in
    my app without
    actually trying to send some "garbage" data on the socket.
    I then get an exception, of course. Is there any clean
    way to implement this?As mentioned the blocking read should do this.
    Myself I always prefer to explicitly send a "end" message from the client (or server.) That way I handle it explicitly rather that relying on something else.

  • Detecting Client Disconnect

    I am looking for a way to determine when a client connects and disconnects (especially the latter) from the grid. Two approaches come to mind:
    1) Polling for something that appears/disappears when a client connects or disconnects. The most obvious candidate is a lock. This approach is inefficient because it requires polling. It also raises the issue of how clients are distinguished, although that is not difficult (e.g. - invocable increments a counter which is used as a basis for the key to lock).
    2) Getting a notification when this happens - preferably in-grid. However, I could find no listener for either the client connect/disconnect event or for locking. Likewise, using custom cache implementations (overriding a class and calling it out in the cache config) doesn't seem to provide notification of either locking, or (an alternate approach) the registration of a listener.
    Overriding a cache indeed provides notice of listener registration, but it appear to be a general listener which is feeding some other internal Coherence facility which manages the specific per-client listeners.

    Answering my own question, after research and help from Gene Glyzer:
    There are a couple of ways to do this:
    1) A client can lock a phantom (or real) entry in a cache. When the client member of the cluster goes away, the lock will be released.
    2) Tracking cluster members:
    * Add a listener:*service = CacheFactory.getService("name").addMemberListener(...)*
    * Get the membership information (synchronously guard against listener events):*Set members = service.getServiceMembers()*
    * Use subsequent listener events to adjust the members set.

  • Server to detect client disconnection "Sockets"

    i want to know how it is possible for a server to find out when the client is disconnected at any instance. not only at the time of sending data...
    i am writing a server that should communicate with different clients, and i want it to be able to find out if a client suddenly disconnects or crashes, so how can this be done?!
    is it this way:
    skt.setKeepAlive(true);the problem is that SO_KEEPALIVE checks after 2 hours, which is too much time, how can i change this value????

    So, i want to be able to find out if the client is disconnected without waiting to send or receive data.Use a read timeout.
    how can i change the value of SO_KEEPALIVEYou can't. It is two hours by default and requires privilege to change it, and changing it is system-wide. So you don't want to do that.
    Use a read timeout. Socket.setSoTimeout().

  • How to detect if any peer gets disconnected

    Hi,
    When a subsribing peer tries to connect to the publishing peer to play the stream, the callback method "onPeerConnect" is executed automatically. But what if any peer (i.e. publishing or subscribing) gets disconnected due to any reason? is there any callback function that is triggered automatically in that case also?
    Thanks in advance.

    I've also been working on disconect detection and reconnection (where possible).
    I hope there's a way to detect a disconnect using only stratus.
    Here's what I have so far and I hope someone else can shed more light on this.
    It looks like a couple events get fired when a disconnect happens.
    NetStream.Connect.Closed
    if you have this set you will see it ...
    netConnection.addEventListener(NetStatusEvent.NET_STATUS,blahlbah
    and
    NetStream.Play.UnpublishNotify
    seems to fire when other peer's outNetStream closes
    I hope someone from Adobe can give us more info.
    A user disconnect event is about as basic as it gets for this kind of stuff.

  • Sockets: How can server detect that client is no longer connected?

    Hi,
    I really need help and advice with the following problem:
    I have a Client - Server socket program.
    The server listens on port 30000 using a server socket on one machine
    The client connects to localhost on port 20000, previously creating an ssh port forward connection using the Jsch package from www.jcraft.com with
    "session.setPortForwardingL(20000, addr, 30000);"
    Then the client sends Strings to the server using a PrintWriter.
    Both are connected to each other through the internet and the server uses a dynamic dns service.
    This all works well until the IP address of the Server changes, The client successfully reconnects to the server using the dynamic dns domain name, but the server keeps listening on the old socket from the previous connection, while opening a new one for the new client connection. The server doesn't seem to notice that Client has disconnected because of this IP address change.
    looks like the server is stuck inside the while loop. If i cut the connection manually on the client side, the server seems to notice that the client has disconnected, and jumps out of the while look (see code below)
    this is the code I'm using for the server:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.Socket;
    import java.util.logging.Logger ;
    public class SocketHandler extends Thread {
        static Logger logger = Logger.getLogger("Server.SocketHandler");
        private Socket clientSocket = null;
        private BufferedReader in = null;
        private InputStreamReader inReader = null;
        public SocketHandler(Socket clientSocket) throws IOException {
            this.clientSocket = clientSocket;
            inReader = new InputStreamReader(clientSocket.getInputStream ());
            in = new BufferedReader(inReader);
        public void run() {
            try {
                String clientMessage = null;
                while ((clientMessage = in.readLine()) != null) {
                    logger.info("client says: " + clientMessage);
            } catch (IOException e) {
                logger.severe(e.getMessage());
                e.printStackTrace();
            } finally {
                try {
                    logger.info("closing client Socket: " + clientSocket);
                    clientSocket.close();
                    in.close();
                    ServerRunner.list.remove(clientSocket);
                    logger.info("currently "+ServerRunner.list.size()+" clients connected");
                } catch (IOException e) {
                    logger.severe (e.getMessage());
                    e.printStackTrace();
    }I've tried making the server create some artificial traffing by writing some byte every few seconds into the clients OutputStream. However I get no exceptions when the IP address changes. The server doesn't detect a disconnected socket connection.
    I'd really appreciate help and advice

    If a TCP/IP peer is shut down "uncleanly", the other end of the connection doesn't get the final end of connection packet, and read() will wait forever. close() sends the final packet, as will killing the peer process (the OS does the close()). But if the OS crashes or for some other reason can't send the final packet, the server never gets notification that the peer has gone away.
    Like you say, one way is timeout, if the protocol is such that there always is something coming in at regular intervals.
    The other way is a heartbeat. Write something to the other end periodically, just some kind of "hello, I'm here, ignore this message". The other end doesn't even have to answer. If the peer has gone away, TCP will retransmit your heartbeat message a few times. After about a minute it will give up, and mark the socket as broken. read() will then throw an IOException. You could send heartbeats from the client too, so that the client detects if the server computer dies.
    TCP/IP also has a TCP-level heartbeat; see Socket.setKeepAlive(). The heartbeat interval is about two hours, so it takes it a while to detect broken connections.

  • Player blocks when USB Headset disconnected during playback

    I am playing a Wav file in my application & using a USB Headset to listen to the playback.
    I'm observing the following behavior while doing this:
    Scenario-USB headset is connected when the application starts up.
    a) Am able to hear the voice on the USB headset when I play the wav file. Also, I get the visual Control Panel component for the player and add it to my application UI.
    Code Segment 1:
    //create player
    //start playback
    //player.start();
    Code Segment 2:
    //In controllerUpdate(ControllerEvent ce)
    //for RealizeCompleteEvent
    if (event instanceof RealizeCompleteEvent) {
    //get the Control Panel Component for player
    Component comp = player.getControlPanelComponent()
    //add the component to the UI
    b) javax.media.StartEvent is fired when the playback begins.
    c) I then disconnect the USB Headset while playback is in progress. The saddle on the Control Panel Component slider bar pauses at it's position as soon as the headset is disconnected. Also, when this happens, no event is fired.
    d) At this stage, if I try to stop the player using a Stop button on my UI, my application hangs. The stop() method called on pressing the Stop button has the following code:
    Code Segment 3:
    //in stop()
    //stop player, close it & deallocate resources
    player.stop();
    player.close();
    player.deallocate();
    In the above steps, no exception is ever thrown nor any event fired signalling the disconnection of the device in use(headset).
    I need to detect the disconnection of my USB headset & prevent the player from blocking, so that I can stop the player & release the resources in a clean way.
    Any suggestions in this regard would be appreciated.
    Thanks!
    ~thebadgrover

    Hi, did you resolve your problem? I have similar problem to detect when a capture device is disconnected.

  • R5970-P2D2G DisplayPort version & monitor disconnection when in standby from Win

    Greetings.
    I've had the graphics card in the subject for a couple of years now, but recently I've upgraded my setup to a triple monitor for Eyefinity in games. The card (product page still visible here: msi.com/product/vga/R5970-P2D2G.html) has two DVI and one miniDP outputs, so the three displays work. Now, because my monitors are Samsung S23A750D models and support 120Hz refresh through DP, I was wondering if the card had DisplayPort version 1.2 which should allow, with a physical split connector, to pilot up to four monitors through the single MiniDP port. The page doesn't say and neither does the manual.
    Secondarily, I've been experiencing a problem with the setup I mentioned. When Windows 7 (x64) puts the monitors in standby, at wake up I find that the icons on the desktop are all jumbled because, apparently the monitor connected through DP registers as disconnected when it's put in standby, while the DVI ones do not. This is an issue with the DP communication channel because switching around the monitors doesn't help, whichever one is connected via DP displays the same behavior. It does not, however, happen if I use the monitors motion sensor or their internal timers to put them in standby.
    This has been happening ever since I purchased the monitors, and as far as drivers go, I've been running the Catalyst 12.4 and now 12.6 through it all, and the monitor .inf drivers as well. Anybody have any input about how to avoid or solve this issue?
    Thanks in advance,
    DeInit

    Quote from: TalosTomsHW on 17-July-12, 20:46:34
    I think you should disable the auto-standby of the monitor... because if the monitor go on standby by its own , the pc clearly recognize it as disconnected.
    P.S. some monitors have a voice in the menu to set the input recognized as an input from pc ( there's a voice that says input : pc  or something like this ), maybe you should look for it and try to use it.
    I should've clarified this, so thank you for reminding me.
    This happens with auto-standby off as well as on, no difference. In fact, I resorted to the auto option only when I disabled the windows option because of its unintended effects. Not that it would make sense for a device in standby to Be detected as disconnected, IMO. In fact, normally devices such as monitors aren't considered disconnected even when they're off, unless they are entirely depowered. When the monitors go in standby through their own means the computer doesn't mind at all, but if it's the computer that switches the DP-connected one, you clearly hear the "device disconnected" tone and, when you resume activity, the one for "device connected" in turn.
    The menu item you mention is there, and it is set for PC. I find that switching it to A/V, as if to use the monitor as a display for a blu-ray player, has the only visible effect to slightly cut the total visible area of the screen, so that if for example you watch a movie, there's a portion of the picture that is cropped out. It does not seem to have to do with how communication with the device is handled, standby-wise.

  • Listen for disconnect

    Is there a way to listen for a disconnect on a java sql
    connection?
    What I am looking for is a method to detect a disconnect either
    on a sql connection that the application is using or set up
    another connection for the sole purpose of listening for a
    disconnect. This is to enable the application to take
    appropriate action should the connection be broken through a
    network fault, database crash or whatever.
    Thanks.

    Your pretty close. Try this..
    ConnectionNode _cn = (ConnectionNode)Ide.getSystem().getChild(ConnectionNode.class);     
    _cn.addNodeListenerForType(DatabaseConnectionNode.class,new NodeListener(){....});
    Then from the event this will get you the connection name
    public void nodeOpened(NodeEvent e){
    DatabaseConnectionNode node = (DatabaseConnectionNode)e.getNode();
    String name = node.getConnectionName();
    }

  • Client Disconnection

    is it possible to detect possible disconnection conditions by using RMI during the execution of a remote method???

    You should try to be more specific about what you want to detect. What do you mean "during", and what (program) do you want to detect the condition?

Maybe you are looking for

  • Updated to v4.5 now phone not working, red light blinking

    K...so I updated to the new software v4.5 on my 8320 curve and now it is not booting up and the red light is blinking twice every few seconds.  I have already removed the battery and done everything that I can think of without using JML because I don

  • Sales Analysis - Gross Profit Percentage

    Hello, This is a very basic question that hopefully somebody can help me with. I ran the Sales Analysis by Customers --> Orders --> for a specific customer.  When I look at the detailed report of the Sales Analysis for this particular customer there

  • Why no 3G iPhone for Taiwan?

    Why, Apple? WHY?! My guess is that deals couldn't be set with Taiwanese service providers. Who knows. Anybody know the real story?

  • HT1222 Unable to Access iPad2

    Unable to access iPad2. it is asking Cannot access my personal email id and asking me to review account settings. But when i tried hitting any of the buttons it is not letting me access. Appreciate your help

  • Linking sequences

    Dear Premiere Community, I have a question about linking two sequences. We are producing some video's that have been shot with a 3D camera; i.e. we have two different video's for the left and right eyes. I've been given a project that has two sequenc