Socket disconnection event not being reveived java.nio

Hi All
My question is as below
i am using java.nio package + win 2K + jdk1.4.1_02
I have a Server accepting socket connection and is configured
in Nonblocking mode.
-The server receives (selector) events (accept event)
when a client requests for a connection .
-The server is getting read and write events when
client wants to read and write
-The server gets a read event when the client disconnects
My only problem is that the Server is not getting any events
when the client disconnect due to network break down
for EX when the network connection breaks the client disconnects
but the server selector is not getting any events
I am storing the client Socket objects in a Hash Table and
if i execute the .isConnected() method it returns true
even though the the client is down
The only work around is to try to read and write on the socket
i get an IO exception and am able to make out that the
client is disconnected
But this is not desirable for my client
as client modification to give any kind of echo is not possible and
a read /write event will cause problem.
Can any one tell how to detect client side disconnection
with out Read and Write on the client socket
I get an socket Exception when the socket is in Blocking IO and is blocked on read/ write but I am facing this problem in NonBlockingIO
Regards
Avinash

int ct = read.selectNow();
if (ct > 0)
Set readyKeys = read.selectedKeys();
Iterator i = readyKeys.iterator();
while (i.hasNext())
SelectionKey key = (SelectionKey) i.next();
i.remove();
if (key.isReadable())
SelectableChannel nextReady = (SelectableChannel) key.channel();
SocketChannel sc = (SocketChannel) key.channel();
int rd = sc.read(buffer);
// Link is dead
if (rd == -1)
key.cancel();
key.attach(null);
nextReady.close();
continue;
// Process your data
catch (Exception e)
e.printStackTrace();

Similar Messages

  • All day calendar events not being displayed in the notification centre for iphone 5 post ios 7 upgrade. Please help. Is it a bug?

    All day calendar events not being displayed in the notification centre for iphone 5 post ios 7 upgrade. Please help. Is it a bug?
    With iOS 6, the all day events showed up in the notification centre but it lacks in the upgrade iOS 7.

    Same problem here. Some people pointed out that all-day events do show up in their notification center, but that seems only to be the case for birthdays (and only as text like the weather). I've tried it myself on my iPhone and iPad and it did work for birthdays but not for any other all-day events. I already sent this to Apple as a product feedback as well, as should everyone of you. The more people mention it, the faster Apple's going to fix this issue. In its current state, notification center is not a very helpful feature in my opinion. There's absolutely no point in not showing all-day events in the 'today' calendar overview.
    Here's a link to the product feedback page: http://www.apple.com/feedback/
    I posted my message in the iPhone section since I couldn't find a page specifically dedicated to iOS 7.
    I really love the look & feel of iOS 7 but it's kinda sad to see notification center not tapping its full potential.
    Cheers!

  • The apexafterrefresh event not being fired in Chart IR's

    Hi all,
    I am adding additional functionality to IR reports using the plug-in architecture in Apex 4.1.1. A Dynamic action has been added to the "After Refresh" event for the #apexir_WORKSHEET_REGION jQuery selector.
    This works fine in all cases except when no data is found in the report. This has been fixed in 4.2 so I can live with this until the upgrade. However, it also does not work when a chart is created in the report, the apexafterrefresh event does not get raised. Therefore my dynamic action will not fire. Looking at the apex_interactive_reports_4_1.js this event gets raised for the table element with an ID stored in apexir_WORKSHEET_ID ie:
    apex.jQuery('#' + $v("apexir_WORKSHEET_ID")).trigger('apexafterrefresh', that.report_id);However this table element does not get rendered when a Chart is displayed and therefore the apexafterrefresh will not get raised.
    In apex 4.2 the widget.interactiveReport.js has been modified to handle the no data found but not charts:
    var lTriggeringElement$, lWorksheetId;
                            lWorksheetId = $v( "apexir_WORKSHEET_ID" );
                            if ( $x( lWorksheetId ) ) {
                                // If the table element containing data exists (ie when the report returns rows),
                                // use that to trigger the event.
                                lTriggeringElement$ = apex.jQuery( '#' + lWorksheetId );
                            } else {
                                // Otherwise, use the span holding the no data found message.
                                lTriggeringElement$ = apex.jQuery( '#apexir_NO_DATA_FOUND_MSG' );
                            lTriggeringElement$.trigger( 'apexafterrefresh', that.report_id );I have created a test case on apex.oracle.com - http://apex.oracle.com/pls/apex/f?p=41357:1 In this example I simply display an alert from a Dynamic action with the following attributes:
    Event - After Refresh
    Selection Type - Region
    Region - Interactive Report
    As can be seen when the user navigates to the report the alert displays, however when you navigate to the Chart the alert does not display.
    In my mind this is a bug and the IR reports JavaScript should be modified to raise the event apexir_WORKSHEET DIV Element instead. This would fix both issues.
    Any ideas on how to overcome this issue?
    Thanks
    Chris.

    For everyone's information Bug 16029272 - ALERT (APEXAFTERREFRESH EVENT) NOT BEING FIRED IN CHART OF INTERACTIVE REPORTS has been raised regarding this issue.

  • Events not being dequeued out of WF_BPEL_Q. No Instances on SOA composites

    We would like to capture a few business events in oracle financials that are of interest to us. In order to do this, we deploy oracle SOA composite with BEPL in the Oracle Fusion Middleware Control. The oracle SOA composite is configured for a particular business event. It listens on a specific queue WF_BPEL_Q and de-queues the messages in that queue. In jDeveloper 11g we created a SOA project with oracle applications adapter partner link and a receive.
    Specifically we are trying to capture the business outbound event oracle.apps.ar.hz.CustAccount.create just to get the event data in this receive.
    Partner link configuration: We added the database connection to the oracle financials instance. Tested it and we succeded. Chose ANY_SCHEMA in partner link configuration.
    We ensured that the JNDI Name here( eis/Apps/Apps ) match the JNDI name provided in the weblogic-->Deployments-->OracleAppsAdapter -->Configuration --> Outbound Connection Pools. For this outbound resource pool, Connection factory interface was javax.resource.cci.ConnectionFactory. Property name xADataSourceName was mapped to JNDI name of the configured JDBC datasource in the weblogic. In our case it was jdbc/AppsDataSource. When we created the connection pool. We tested and it worked fine. This data source had the connection pool configured to the oracle applications schema with APPS user.
    After adding the partner link with the above configuration, we added a receive. We deployed this configuration to the middleware. We went to the oracle financial, created a customer and account and we expected to having running instances against the deloyed composite. However, the problem is we are not having any running instance for the composite.
    We found that there are entries in the view AQ$WF_BPEL_QTAB with an ENQ_TIME and ENQ_TIMESTAMP but with no DEQ_TIME or DEQ_TIMESTAMP. The ENQ_TIMESTAMP corresponds to the time we created the customer and accounts in oracle financials and the USER_DATA column has the business event of interest. The events are enqueued in WF_BPEL_Q but not being dequeued by oracle applications adapter/composites deployed in soa server. Consumer name on AQ$WF_BPEL_QTAB matched with the consumer name on the deployed composite at the Oracle Enterprise manager.
    Any help would be highly appreciated. I have put in the initial set of information here. Please do let me know, if you would need any other information. I shall be more than happy to provide that.
    VERSION INFORMATION:
    We are using Weblogic Server 10.3.1.0 and Oracle Enterprise manager 11.1.1.1.0.
    Thanks,
    Prakash
    Edited by: user9169972 on Mar 26, 2010 5:28 PM

    I'm facing a similar problem. In my case, there is notifications on Oracle SOA Suite, but the message in wf_bpel_qtab still remains.
    Did you find something?
    Thanks.

  • Dispatched Event not being caught

    I have the following custom event:
    package
    import flash.events.Event;
    public class TestCustomEvent extends Event
    public static const EVENT_NAME:String = "TestCustom";
    public var _message:String;
    public function TestCustomEvent(message:String)
    super(EVENT_NAME,true,false);
    this._message = message;
    public override function clone():Event
    return new TestCustomEvent(_message);
    public override function toString():String
    return formatToString("TestCustomEvent", "type", "bubbles",
    "cancelable", "eventPhase", "_message");
    which I am trying to dispatch from the following class:
    package
    import flash.events.EventDispatcher;
    import flash.events.IEventDispatcher;
    import flash.events.Event;
    public class TestDispatch implements IEventDispatcher
    private var dispatcher:EventDispatcher;
    public function TestDispatch()
    dispatcher = new EventDispatcher(this);
    public function RaiseEvent():void
    var ev:TestCustomEvent = new TestCustomEvent("catch this");
    this.dispatchEvent(ev);
    public function addEventListener(type:String,
    listener:Function, useCapture:Boolean = false, priority:int = 0,
    useWeakReference:Boolean = false):void{
    dispatcher.addEventListener(type, listener, useCapture,
    priority);
    public function dispatchEvent(evt:Event):Boolean{
    return dispatcher.dispatchEvent(evt);
    public function hasEventListener(type:String):Boolean{
    return dispatcher.hasEventListener(type);
    public function removeEventListener(type:String,
    listener:Function, useCapture:Boolean = false):void{
    dispatcher.removeEventListener(type, listener, useCapture);
    public function willTrigger(type:String):Boolean {
    return dispatcher.willTrigger(type);
    but in my application the event doesn't get caught:
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()" initialize="addListeners()">
    <mx:Script>
    <![CDATA[
    private function addListeners():void
    this.addEventListener( TestCustomEvent.EVENT_NAME,
    onEventCaught );
    private function init():void
    var t:TestDispatch = new TestDispatch();
    t.RaiseEvent();
    public function onEventCaught(event:TestCustomEvent):void
    trace("caught");
    ]]>
    </mx:Script>
    </mx:Application>
    Not sure why event is not being caught.
    Thanks,
    EE

    I updated my code a little:
    //Using a sprite so it should be part of the diplay list now.
    package
    import flash.display.Sprite;
    public class TestClass2 extends Sprite
    public function TestClass2()
    super();
    public function RaiseEvent():void
    var ev:TestCustomEvent = new TestCustomEvent("catch this");
    this.dispatchEvent(ev);
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()" initialize="addListeners()"
    xmlns:local="*">
    <mx:Script>
    <![CDATA[
    private function addListeners():void
    this.addEventListener( TestCustomEvent.EVENT_NAME,
    onEventCaught );
    private function init():void
    tc2.RaiseEvent();
    public function onEventCaught(event:TestCustomEvent):void
    trace("caught");
    ]]>
    </mx:Script>
    <local:TestClass2 id="tc2" width="100" height="50" />
    </mx:Application>
    But event still not being caught.

  • Javax.swing.Timer not working or event not being captured by actionPerfrmd

    Here is the code:
    public class nQueensEst extends JApplet implements ActionListener {
      public Timer t = new Timer(1, this);
    //...the actionPerformed:
    if(e.getSource() == jButton1){
                nRainhas=Integer.parseInt(javax.swing.JOptionPane.showInputDialog("Quantas rainhas voc? deseja?"));     
                t.start();
                int contadorTentativas=1;
                for(int i=0; i<=100; i++){
                    sol=new int[nRainhas];
                    while(!rainhas()){
                      jLabel1.setText(contadorTentativas +" tentativas!!!");
                      contadorTentativas++;            
                    jLabel2.setText("Solu??es: "+Integer.toString(i));
    t.stop();
    }else if(e.getSource() == t){
         System.out.println("timer");
         rodadas++;
    Any clue?
    Thanks

    Let me explai the context: i had to implement a classic nQueens problem using a Grasp Algorithm and a Backtrack algorithm, then in dorder to compare them, i want to make the garap one to run find 100000 solutions and register the time it is needes, then divide by 100000. so i need the timer running and making a variable increase every millisecond from the beggining until the end of the last solution. But the timer is not generating a event or the event is not being caought by the actionPerformed.

  • Batch Events not being raised

    I can't determine why the seeded events oracle.apps.gme.batch.unrelease, oracle.apps.gme.batch.close, and oracle.gme.batch.reopen are not firing. The events are all enabled as are the subscriptions which are set to phase 50. The only batch event which is firing is oracle.apps.gme.batch.release.
    I am assuming that those seeded events for various batch actions should be automatically raised regardless of whether there are Erecords or Esignatures required for them. I am assuming this because Batch Release events are working and the event subscriptions I have created are being picked up as well.
    Does anyone have any idea why those events would not automatically be raised when those actions are taken?
    Thank you!

    I can't determine why the seeded events oracle.apps.gme.batch.unrelease, oracle.apps.gme.batch.close, and oracle.gme.batch.reopen are not firing. The events are all enabled as are the subscriptions which are set to phase 50. The only batch event which is firing is oracle.apps.gme.batch.release.
    I am assuming that those seeded events for various batch actions should be automatically raised regardless of whether there are Erecords or Esignatures required for them. I am assuming this because Batch Release events are working and the event subscriptions I have created are being picked up as well.
    Does anyone have any idea why those events would not automatically be raised when those actions are taken?
    Thank you!

  • Looping, Clickable FLV Preview - Click Event not being recognized

    I have tried the following code to create a thumbnail preview that loops and is clickable to go to a new page with a video gallery... The video plays anbd loops, but, it does not seem to recognize the mouse click -- i have a trace that isn't being triggered an nothing happens... code is below. any help appreciated...
    import fl.video.VideoEvent;
    import flash.events.MouseEvent;
    player.fullScreenTakeOver = false;
    player.source =
    "YadWebPreview.flv";
    player.autoRewind = true;
    player.autoPlay = true;
    function Loop(event:VideoEvent):void
    player.play();
    function Link(event:MouseEvent):void
    trace("Clicked");
    navigateToURL(
    new URLRequest(
    "http://yad.nyckatz.com/index.php/about-us/meet-our-people"),
    "_blank");
    player.addEventListener(VideoEvent.AUTO_REWOUND, Loop);
    player.addEventListener(MouseEvent.CLICK, Link);

    I added a button on top of the video and made it transparent.  added the  following code to the button:
    import flash.events.MouseEvent;
    function Link(event:MouseEvent):void
    trace("Clicked");
    navigateToURL(
    new URLRequest(
    "http://yad.nyckatz.com/index.php/about-us/meet-our-people"),
    "_blank");
    myButton.addEventListener(MouseEvent.CLICK,Link);
    getting the following compler errors:
    5000: The class 'fl.controls.Button' must subclass 'flash.display.SimpleButton' since it is linked to a library symbol of that type.
    and the following in the output tab
    ReferenceError: Error #1065: Variable Icon is not defined.
    ReferenceError: Error #1065: Variable FLVPlayback is not defined.
    ReferenceError: Error #1065: Variable ComponentShim is not defined.
    have the following code on the video:
    import fl.video.VideoEvent;
    player.fullScreenTakeOver = false;
    player.source =
    "YadWebPreview.flv";
    player.autoRewind = true;
    player.autoPlay = true;
    function Loop(event:VideoEvent):void
    player.play();
    player.addEventListener(VideoEvent.AUTO_REWOUND, Loop);
    Can't find anything to help figure out how to correct these...  Any help much appreciated.

  • Wait for Event not being picked up by workflow

    Hi,
    We have a purchase order workflow that has a parallel branch with a wait for event of 'Released' on it. The theory is that if a PO is released the workflow will finish. We have a situation where POs are created then released straight away by an idoc. In the event log we can see the release step created event and it correctly starts the workflow however the released event follows at exactly the same time and the workflow does not seem to notice this so it sends a released PO to a user to be released. I hope this makes sense. Can anyone think of a reason why this might be happening? Does it need a slight delay between the two events?  In SWEINST the linkage is active and when I look at the entry for one of these POs it tales me to the correct workflow.
    Thanks
    Rob

    Hi,
    You could possibly create a check function module for the event. In the check function module you check some specific variable (if there is something you can use) - for example if the event was created by a certain user or if the PO is a certain type(?). Then if your condition is fulfilled, you raise an exception and no event will be triggered => no workflow.
    This is just one possible solution.
    Regards,
    Karri

  • OnChange and DropDownList's - event not being dispatched

    I can't get an onChange event to fire when making a ListItem selection in a DropDownList control. Am I doing something wrong? (I'm running XP Pro 32bit)
         var dlg = new Window('dialog');
         var pnl = dlg.add('panel');
         var myDDList1 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name: 'ddList1'});
         myDDList1.addEventListener('change', myFunction);
         var myDDList2 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name:'ddList2'});
         myDDList2.addEventListener('change', myFunction);
         var myDDList3 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name:'ddList3'});
         myDDList3.addEventListener('change', myFunction);
          function myFunction(ev)
              var ddl = ev.target;
              var props = ddl.properties;
              if(props.hasOwnProperty('name'))
                   switch(props.name)
                        case 'ddList1':
                            alert ('change made in ddList1');
                        break;
                        case 'ddList2':
                            alert ('change made in ddList2');
                        break;
                        case 'ddList3':
                            alert ('change made in ddList3');
                        break;
              ddl = null;
              props = null;
         dlg.show();

    Thank you, that works perfectly. Is it because invoking the function using this method
    myDDList1.onChange = myFunction;
    the onChange Event actually contains a copy of myFunction(), and the this keyword used in the function is a reference to the element the onChange event is registered to; in this case myDDList1? Whereas, invoking the function using this method
    myDDList1.addEventListenter('change', myFunction);
    myFunction() is not copied, but only referred to when the onChange event happens? Still not sure why it wouldn't work, though. Mousedown, mouseover, and other Events trigger the function using this method and event.target can be used to refer to the element that triggered the Event.
    Thanks again!

  • Calendar events not being sent immediately.....finding out when I created an event.

    I recently created a calendar event on my iPhone 5.  I invited an attendee who received the event too late (approximately 36 hours later).  Is there a way to verify and view when I created the event?  Also, is this a common problem?  Why would this have happened?  It definitely makes me not trust using the calendar app for creating and sending event invites.  It is CRITICAL that I view when I created the event.  Thanks in advance for any help or advice.

    Hi Dave,
    From your description, the mailbox you use for conference is not a special room mailbox. It is a standard user mailbox. I think that is the problem, it should be configured as a room type and not a user mailbox.
    If I have misunderstood your concern, please feel free to let me know.
    What's more, about how to create and manage room mailbox, here are some helpful threads for your reference.
    Create a Room or Equipment Mailbox
    http://technet.microsoft.com/en-us/library/bb124952(v=exchg.141).aspx
    Managing Resource Mailboxes and Scheduling
    http://technet.microsoft.com/en-us/library/bb124374(v=exchg.141).aspx
    Hope it helps.
    If you need further assistance, please feel free to let me know.
    Best regards,
    Amy
    Amy Wang
    TechNet Community Support

  • 30 days and older events not being deleted automatically

    Under iCal preferences I have checked "Delete events older than 30 days", but its not happening, events from months ago are still sitting there and I have to go in and delete them manually. Am I doing something wrong? I use a iTouch and an iMac

    I have tried "Refresh" and "Refresh All", but that didn't do it. What did work was "Quit" iCal and open up again

  • Projects/Events not being saved.

    I am having major problems with FCPX.
    I have edited and re-edited the same movie about 20 times now. Every time, at some stage, the undo feature stops working and when I quit and re-open FPCX I am just seeing the project at the very start of my work, nearly all the work is lost.
    Have tried deleting pref files and have even totally re-downloaded and installed from the app store, still no luck.
    This is very, very frustrating, if there was a 'save as' feature I could live with it.
    Other posts have suggested 'duplicating the project', but when I go to the project library view, that also causes most of the project to be lost, just by going off of the timeline view.
    Please help, I am at my wits end with this.

    Are you possiby working in the timeline rather than a project? So that your window looks something like this?
    Rather than something like this:
    Russ

  • Socket seems too slow...maybe java.nio?

    Hello
    In our system I have to receive Multicast Packets repeats very quick(1-5 ms). I have to link them one after an other in the order they sent. And if I miss a packet, something will go wrong...
    I have to listen to different IPs and I use different threads for different IPs. If I use only one thread (and listens to only one IP) everything seems ok.
    But if I starts listening to an other ip too, I miss 2 packets in a row, or only one if I turn off parsing the message (XML).
    Here is the code I use in the Threads:
    try{
                   socket = new MulticastSocket(port);
                   socket.setSoTimeout(1000);
                   inetAddress = InetAddress.getByName(ip);
                   NetworkInterface nInterface=
    NetworkInterface.getByName(networkInterface);
                   if(nInterface!=null)socket.setNetworkInterface(nInterface);
                   socket.joinGroup(inetAddress);
              catch(IOException ioe){
                   logger.error(ioe.getMessage(), ioe);
    return;
              try{
                   while (!interrupted()) {
                        try{
                             byte[] buffer = new byte[1480];
                             packet = new DatagramPacket(buffer, buffer.length);
                             socket.receive(packet);
    parse(buffer);
                        }catch(SocketTimeoutException stoe){
                             //     DO NOTHING
                        }catch(IOException ioe){
                             logger.error(ioe.getMessage(), ioe);
              }finally{
                   try {
                        if(socket!=null){
                             socket.leaveGroup(inetAddress);
                   } catch (IOException ioe) {}
    Every Thread has its own parsing object.
    Any tips, what is wrong?
    Maybe java.nio could solve the problem somehow. There is a sample server in [Java Home]/sample/nio/server and it suggest that there are quicker methods to receive messages from different IPs (maybe Blocking/Pooled-Thread Server). But I can't understand the API and the Sample while I was reading it (20-30 minutes).
    Could it be quicker? Does it worth toying with the idea?
    Thanks:
    Bence

    In our system I have to receive Multicast Packets
    repeats very quick(1-5 ms). I have to link them one
    after an other in the order they sent. And if I miss
    a packet, something will go wrong...There is no guarantee anywhere in the system that you won't miss a datagram. UDP doesn't make such guarantees. If you need all the packets you will have to build ACK or NACK into your protocol.
    You can alleviate the problem by running a very large socket receive buffer. But you can't eliminate it. Rethink this.
    NIO is not significantly quicker for applications like this, it is more scalable.

  • Java Portal Event not received correctly by ABAP Webdynpro

    We have a page that contains 2 iviews. 
    iView 1 contains the MSS Employee Search that raises portal event:
    Namespace: "urn:com.sap.mss.employeesearch"
    Name: "selection_changed"
    The second iview contains an ABAP Webdynpro program that subscribes to the Portal event. 
    The issue is that the event in the ABAP webdynpro is not being triggered.  It does get triggered if we first fire the event from the Java program, unsubscribe the event in the ABAP program them subscribe to the event in the ABAP program.  The event gets triggered at this time and the parameter can be retrieved. 
    If the event is fired a second time, nothing happens in the ABAP program. 
    The abap program works fine when another abap program triggers the same portal event.
    Also, the portal event is being picked up correctly by other SAP delivered JAVA programs.  I just cannot get a custom ABAP Webdynpro program to work...
    Any ideas, comments?
    Glenn

    Hi Glenn,
    Are you using https? Is your j2ee stack and abap stack in the same domain? In the past I have found that https can cause issues in the event communication between different applications.
    Cheers,
    Dion

Maybe you are looking for

  • Problems with new update of Numbers for Maverick

    When opening any of my documents creted on a alder version of Numbers, I lose the format that I had on the page. The table or spreadsheet stays intact, but no the document perse. Where is the "Show Print View" feature on the new update of Numbers. I

  • Cross Tab Header

    Hi everyone! I have a problem with a cross table. I don't know how many columns will be displayed and I need an header row that covers all the dynamic columns... how can I get a layout like this? |----------------------------HEADER-------------------

  • Problem reading html and rtf emails

    When I send emails from my pc to my iPhone 5 in html or rtf format they are unreadable as all of the coding instructions are also included in the text when it appears on screen. This was never a problem with my iPhone 4 so I am not sure what has chan

  • Using an MS Excel like template for data entry into an Oracle table

    Does anybody know of a way, or development tool, that has the look and feel of MS Excel but can be used for data entry and be saved to an Oracle table and be embedded into a JSP page? I am currently using iSupport and have a need to allow users to en

  • Sort Nested Object - 2 properties

    Hello, I am trying to sort based on a few properties of an object. The only issue i am having is the properties are within a nested object. For example. I would like to stort the following object by StreetNumber and StreetName, but these properties a