Socket read fails but write is successful. Why?

Hi once more!
I have a Java application, reading and writing from/to a client socket:
InputStream is = socket.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
i = br.read();
...If i is equal to -1, it means there's no connection or that somehow the connection is unavailable right? So, how come is it possible to write to the socket's output stream with success after that read( ) returning -1? Shouldn't it also fail?
I'm trying a "persistent" TCP connection, so I use that condition (read () == -1) to determine when the connection is down (read() is only blocking a certain amount of time).
Thanks!

I suggest you to have a process constantly
sending a byte just to check that you still have
the ability to send a packetNow you've got it.That's what I'm doing, yet I feel in my case it's not enough.
I communicate with the server asynchronously. I send packets.. somewhen the server sends packets to my client.
This way, I have to be continuously reading from the socket's Input Stream, in order to check for incoming packets (which may arrive at any time)... Thus, I have to be sure I can read from the socket..
As the connection may timeout (if neither my client nor the server write anything to the socket) I send a dummy packet once per minute.
However:
1) This is too long to check connection status (only 1 time each minute)
2) It doesn't tell me I can read ok from the socket - check the case where I could write but read ( ) returned -1. This is abnormal behaviour in my case.. do you think if the server was sending some packets, my read ( ) would be able to capture them (even after returning -1 for quite a while)? It seemed to me I was able to send, yet unable to receive.. or my packets weren't actually reaching the server even though they seemed to be.
What write does is cause packets to be sent which
require acknowledgement, and if the ACKs don't
arrive, eventually a subsequent write() will fail. A
read doesn't engage in any wire protocol at all,
which is why it can't be used to detect a connection
failure other than via a read timeout, or as a result
of prior writes.Why does write ( ) doesn't fail when I unplug the cable? Either way this situation isn't quite important, as long as my packets start actually reaching the server after the cable is plugged back in. Curious, however, how write ( ) doesn't fail..

Similar Messages

  • We've been downloading books to our nook for years but recently keep getting error message "failed to write destination file"  - why?

    what is "failed to write destination file"?

    I had this problem as well, and after doing some research via google (because I found NOTHING helpful in adobe forums), I found the problem....my Nook was full.  I had no idea this was even possible!  But, I borrow a lot of library books, and didn't realize that after they expire, they are still taking up space on my Nook.  Here's how to check: plug your Nook into your computer, go to file manager (right-click the start button in Windows), find the Nook drive and right click, choose properties.  This should show you a pie chart of used/free space on your Nook.  If this is the case, you need to remove some files from your Nook.  For me, I had to find the Digital Editions file and delete all the thumbnails and actual files for the library books.  If it's booked you've purchased, perhaps you need to archive some books.  Hope this helps!

  • Apple Hardware Test (AHT) Hard Drive Full Read Fail But SMART Status OK

    I have a Mac mini Server from Mid 2010 running Snow Leopard Server.
    Ocassionally, it'll freeze up with the spinning beachball wheel for a few minutes. This usually happens when opening an app or performing an app function from the menu bar. It's a pretty clean system—there are not many apps installed.
    I suspect it's a hadrware issue. I ran Disk Utility's Permission and Disk Repair. All good. SMART Status is verified. So I ran the Apple Hardware Test. Everything passes except for the Hard Drive's "Full Read"—it fails because "Reading took longer than the average time". The Hard Drive "Short .. test" and "Check SMART Status" pass.
    Does anyone have an idea of what's going on here? Is the hard drive the issue? I don't understand how there can be a read issue (or hard drive issue), when the SMART Status is verfied.

    S.M.A.R.T isn't perfect. Neither is AHT for that matter, but if it is reporting that reading is taking longer than it should then an impending failure is likely. The occasional "wait cursor" appearance supports that diagnosis.
    Consider yourself fortunate in that you still have the ability to back up anything important, and you can plan a convenient time for its replacement.

  • I have US holidays (read only) but not UK. Why when I live in

    UK. Hubby has same phone and his is UK. I checked in setting and everything says UK????

    Using Safari on your iPhone, go here
    -> http://www.apple.com/downloads/macosx/calendars/unitedkingdomholidaycalendar.htm l
    tap Download then tap Yes when it asks if you want to subscribe to the calendar.

  • I used scripting brigde to add a movie that has size bigger than 5GB, exactly after two minutes iTunes return a failed, but the processing of the file is actually added to iTunes Library successfully. The copying take more than 5 minutes to complete. Why?

    I used scripting brigde to add a movie that has size bigger than 5GB, exactly after two minutes iTunes return a failed, but the processing of the file is actually added to iTunes Library successfully. The copying take more than 5 minutes to complete. Why the iTunes Scripting Brigde returned failed when it is actually success? It occurred exactly 2 minutes after submit the request to Scripting Brigde. Is this 2 minutes related to the Apple Event time out? if it does, how do I get around this problem? thx

    I can tell you that this is some of the absolutely worst customer service I have ever dealt with. I found out from a store employee that when they are really busy with calls, they have third party companies taking overflow calls. One of those companies is Xerox. What can a Xerox call center rep possibly be able to authorize on a Verizon account?  I'm Sure there is a ton of misinformation out there due to this. They don't note the accounts properly or so everyone can see them. I have been transferred before and have asked if they work for Verizon or a third party also and was refused an answer so, apparently they aren't required to disclose that information. I spent a long time in the store on my last visit and it's not just customers that get the runaround. It happens to the store employees as well and it's beyond frustrating.

  • DVD/CD drive read/writes DVD, reads CD, but suddenly fails to recognize CDr

    I'm having a problem that I just don't understand, and I can't seem to find any information on, so I'm hoping somebody out there has some thoughts.
    I have a powerbook 17 with the DVD/CD listed below (from system profiler).
    This drive has always worked perfectly, but now I find that I can:
    - play DVDs
    - burn DVDs
    - play/read CD
    but when I insert a CDr to burn, the icon never shows up on the desktop. Running disk utility lists it as a CD (read only) -- I'm not sure if disk utility is valid in this context or not, but I had to start it so that I could get at the CD to eject it.
    At first I thought it might be the media I was using, but I tried two different kinds -- both failed, then I found some blanks of the brand and type that I've been using forever...failure.
    So, can this be a hardware error? If so, how can a hardware drive error only affect recognizing writeable CDs? If this is the case, I'd like to learn something! =:-)
    The only thing that's changed on this system is that I regularly run software updtate...everything's up to date. This is OSX 10.3.9.
    Thanks,
    keith
    MATSHITA DVD-R UJ-816:
    Manufacturer: MATSHITA
    Model: MATSHITA DVD-R UJ-816
    Revision: DXJ3
    Serial Number:
    Drive Type: CD-RW/DVD-RW
    Disc Burning: Apple Supported/Shipped
    Removable Media: Yes
    Detachable Drive: No
    Protocol: ATAPI
    Unit Number: 0
    Socket Type: Internal

    Keith, just for grins, go to your Apple and click it and then choose System Preferences, and when it opens choose CD-DVD and see what option you have checked for the different media.
    Just a chance when you did an update it might have changed a default setting you had.
    Don

  • Why should Adobe Reader fail to print because of settings in the Edit/Preferences?

    AdobeReaderDocumentCouldNotPrint.txt
    Glyn Price Tue 17 March 2015
    Why should Adobe Reader fail to print because of settings
    in the Edit/Preference?
    Adobe Reader XI Version 11.0.10
    MS Window 7
    File > Print > Print
    I got the error message:
    The document could not be printed
    I googled this error message and used the following
    solution that worked i.e. it then printed successfully.
    Edit >  Preferences
    Category: Security(Enhancement)   'Enable Protected  Mode at Startup'
    It was checked, changed it to unchecked.
    Category: Documents    'View documents in PDF/Mode'
    It was set to 'Only for PDF/A'
    Set it to 'Never'
    Exited Adobe Reader and restart it. Then it printed.
    I had a look on another computer system (Adobe Reader XI Version 11.0.10
    and MS Window 7) and on this different computer I could print
    without doing the above two changes.
    I'm a bit puzzled. Why preferences on one system were not
    needed on a different system?

    Here is an elaborate method of troubleshooting this problem. There may be a simpler method if anybody wants to suggest one.
    There is a general technique that is helpful in this situation. I can't give you complete instructions here, and I haven't tested this with regard to bluetooth devices, but here's the gist of it.
    Create a second log-on account for your music projects. Configure it so that when you log in to the new music account, the drivers needed for the Bluetooth devices don't load. You do this in System Preferences: Accounts.
    When it's time to do music, log out of your usual account and onto the new one.
    When you install drivers for any peripheral, you have the option of installing them "for all users" or only for the user account that is active during the installation.
    This governs whether the drivers go in root/library or root/Users/your name/library.
    If drivers are in root/library, they will load whenever the Mac is booted up and will run for all users.
    But if drivers are loaded in root/Users/your name/library, they will only load if you log in as "your name". If you have a second account called root/Users/music account/, and you log in under that, the drivers in "your name" will not load. Get it?
    To get this working right you need to be knowledgeable about moving or deleting files in the /library/ directory and subdirectories, and you need to be careful because you can unwittingly cause some damage if you are not careful.
    There is also the root/System/library directory, and in general you should never mess around with anything in there or you might hose your system.
    In summary, I would start by using the installer programs for your BlueTooth devices and DE-installing all drivers. Reboot. Log back in as your usual user account. Then RE-install each driver and see if the installer program gives you the OPTION to installl for all users or just for this user. Choose the latter. Then log on to your new Music account and see if the problems go away.

  • WebLogic 11g data source connection pooling failed with IO error:socket read timed out.

    Hi all,
    We encountered IO Error: Socket read timed out( <Received exception while creating connection for pool "DS_1": IO Error: Socket read timed out> ) during the creation of data sources in WebLogic 11g. Manual data source testing seems to indicate intermittent connection and the server seems to take a long time to start up with multiple IO errors. We increased the timeout at the database side but it does not seems to help. The database is 11g (11.2.0.3). The database services and listener are up which does not indicate that the database instance is down.

    This particular error means your database is down and socket is timedout. Or the query takes so long that the reader timedout -- unlikely.
    Also, the general weblogic socket write errors, which you might see sometimes means that the client got disconnected before the server wrote results back. This is harmless

  • Why can't I get my mail, I get a message "connection to server failed" but I can get on all other web sites.  It worked fine until about a month ago.

    WHY CAN'T I GET MY MAIL, I GET A MESSAGE 'CONNECTION TO SERVER FAILED" BUT I CAN GET ON ALL OTHER WEB SITES.  IT WORKED FINE UNTIL ABOUT A MONTH AGO.  I CANCELLED MY ACCOUNT, PUT MY INFO IN AGAIN AND STILL GET THE MESSAGE "CONNECTION TO SERVER FAILED"  HELP PLEASE!

    have you tried removing and readding the e-mail account? sometimes settings get corrupted or changed on the server end...something computers can sometimes handle better than the mail interface.

  • TS3992 My iPad hasn't backed up to iCloud for 2 weeks so I've connected it to my laptop and it still won't backup and this is AFTER I paid for extra iCloud storage. I'm so frustrated because it keeps saying back-up failed but I don't know why.

    My iPad hasn't backed up to iCloud for 2 weeks after repeated attempts even AFTER I paid extra for more iCloud storage. I've connected it to my laptop and it still won't backup. I'm so frustrated because it keeps saying back-up failed but I don't know why. Please help, thanks!

    To back up to your computer, right-click on the name of your iPad on the left side of iTunes and click Back Up.  (If running iTunes 11, first go to View>Show Sidebar.)
    To get your iPad to back up to iCloud again, try deleting your last backup (if you have one) by turning off iCloud Backup in Settings>iCloud>Storage & Backup, then tap Manage Storage, swipe across your backup and tap Delete, then go back and turn iCloud Backup back on again.  If it still won't back up, you may have an app that is preventing the backup from succeeding.  To locate which one, go to Settings>iCloud>Storage & Backup>Manage Storage, tap the name of your device under Backups, under Backup Options tap Show All Apps, then turn them all to Off (including camera roll) and try backing up again.  If it succeeds, then the camera roll and/or one of your apps is preventing the backup and you'll have to located by process of elimination. Turn the camera roll On and try backing up again.  If it succeeds, turn some of your apps to On and try backing up again.  If it succeeds again, turn some more apps to On then try again; repeat this process until it fails.  Eventually you'll be able to locate the problem app and exclude it from your backup.
    If it still won't back up you may have network issues connecting to the iCloud server.  Solutions to that include power-cycling your wireless router (unplugging it for 15 seconds, then plugging it back in), resetting network settings on your phone (in Settings>General>Reset), updating the firmware on your router, and changing the router's DNS settings to use Google's public DNS (see https://developers.google.com/speed/public-dns/docs/using).

  • Why is my macbook pro running slow.  It runs slow even if only one app is open, especially if it's a browser.  I don't know how to read Etrecheck, but was hoping someone who does can help me out.  Would be super grateful.  :-)

    Hi.  This is my first time posting.  My Macbook Pro with Os X Mavericks has been running super slow since before I installed Mavericks so I'm pretty sure it's not the OS that has the problem.  It runs slow even if only one app is open, especially if it's a browser, particulary google chrome.  If mail is open...forget about it, down to a crawl.  I don't know how to read Etrecheck, but was hoping someone who does can help me out.  Would be super grateful.  :-)
    P.S. - Also, it sounds like something is loose inside my mac.  How should I proceed?
    Thanks in advance.
    Hardware Information:
              MacBook Pro (13-inch, Late 2011)
              MacBook Pro - model: MacBookPro8,1
              1 2.8 GHz Intel Core i7 CPU: 2 cores
              4 GB RAM
    Video Information:
              Intel HD Graphics 3000 - VRAM: 384 MB
    System Software:
              OS X 10.9.2 (13C1021) - Uptime: 0 days 23:21:37
    Disk Information:
              APPLE HDD HTS547575A9E384 disk0 : (750.16 GB)
                        EFI (disk0s1) <not mounted>: 209.7 MB
                        Macintosh HD (disk0s2) / [Startup]: 749.3 GB (603.2 GB free)
                        Recovery HD (disk0s3) <not mounted>: 650 MB
              MATSHITADVD-R   UJ-8A8 
    USB Information:
              Apple Inc. Apple Internal Keyboard / Trackpad
              Apple Inc. BRCM2070 Hub
                        Apple Inc. Bluetooth USB Host Controller
              Apple Inc. FaceTime HD Camera (Built-in)
              Apple Computer, Inc. IR Receiver
    Thunderbolt Information:
              Apple Inc. thunderbolt_bus
    Gatekeeper:
              Mac App Store and identified developers
    Kernel Extensions:
              [not loaded] com.leapfrog.driver.LfConnectDriver (1.8.0 - SDK 10.7) Support
              [not loaded] com.seagate.driver.PowSecDriverCore (5.0.1) Support
              [not loaded] com.seagate.driver.PowSecLeafDriver_10_4 (5.0.1) Support
              [not loaded] com.seagate.driver.PowSecLeafDriver_10_5 (5.0.1) Support
              [not loaded] com.seagate.driver.SeagateDriveIcons (5.0.1) Support
    Problem System Launch Daemons:
              [failed] com.apple.wdhelper.plist
    Problem System Launch Agents:
              [loaded] com.paragon.NTFS.auth.plist Support
    Launch Daemons:
              [loaded] com.adobe.fpsaud.plist Support
              [loaded] com.google.keystone.daemon.plist Support
              [loaded] com.leapfrog.connect.shell.plist Support
              [loaded] com.macpaw.CleanMyMac2.Agent.plist Support
              [loaded] com.microsoft.office.licensing.helper.plist Support
              [running] com.sophos.autoupdate.plist Support
              [running] com.sophos.intercheck.plist Support
              [running] com.sophos.notification.plist Support
    Launch Agents:
              [not loaded] com.adobe.AAM.Updater-1.0.plist Support
              [loaded] com.google.keystone.agent.plist Support
              [running] com.seagate.SeagateStorageGauge.plist Support
              [running] com.sophos.uiserver.plist Support
              [running] org.chromium.chromoting.plist Support
    User Launch Agents:
              [loaded] com.adobe.AAM.Updater-1.0.plist Support
              [loaded] com.adobe.ARM.[...].plist Support
              [failed] com.adobe.ARM.[...].plist Support
              [loaded] com.facebook.videochat.[redacted].plist Support
              [loaded] com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist Support
              [loaded] com.macpaw.CleanMyMac2Helper.scheduledScan.plist Support
              [loaded] com.macpaw.CleanMyMac2Helper.trashWatcher.plist Support
    User Login Items:
              Activity Monitor
              Dropbox
              Google Drive
              younity
              EvernoteHelper
    Internet Plug-ins:
              o1dbrowserplugin: Version: 5.2.4.18058 Support
              nplastpass: Version: 2.5.5 Support
              Default Browser: Version: 537 - SDK 10.9
              AdobePDFViewerNPAPI: Version: 11.0.06 - SDK 10.6 Support
              FlashPlayer-10.6: Version: 13.0.0.206 - SDK 10.6 Support
              Silverlight: Version: 5.1.20125.0 - SDK 10.6 Support
              Flash Player: Version: 13.0.0.206 - SDK 10.6 Support
              QuickTime Plugin: Version: 7.7.3
              googletalkbrowserplugin: Version: 5.2.4.18058 Support
              SharePointBrowserPlugin: Version: 14.4.1 - SDK 10.6 Support
              AdobePDFViewer: Version: 11.0.06 - SDK 10.6 Support
              JavaAppletPlugin: Version: 14.9.0 - SDK 10.7 Check version
    Safari Extensions:
              Slick Savings: Version: 1.0
              Slick Savings: Version: 1.0
              Surfon: Version: 1.2.2
              Pearltrees Extension: Version: 6.0.13
              Mindomo Bookmarks: Version: 1.0
              Ebay Shopping Assistant: Version: 1.1
              Zootool: Version: 0.7
              Amazon Shopping Assistant: Version: 1.1
              Pocket: Version: 1.7.1
              Searchme: Version: 1.3
    Audio Plug-ins:
              BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
              AirPlay: Version: 2.0 - SDK 10.9
              AppleAVBAudio: Version: 203.2 - SDK 10.9
              iSightAudio: Version: 7.7.3 - SDK 10.9
    iTunes Plug-ins:
              Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
    User iTunes Plug-ins:
              TuneUp Visualizer: Version: 2.4.0 - SDK 10.6 Support
    User Internet Plug-ins:
              Picasa: Version: 1.0 - SDK 10.4 Support
    3rd Party Preference Panes:
              remoting_host_prefpane  Support
              Flash Player  Support
              Paragon NTFS for Mac ® OS X  Support
    Time Machine:
              Mobile backups: ON
              Auto backup: YES
              Volumes being backed up:
                        Macintosh HD: Disk size: 697.84 GB Disk used: 136.06 GB
              Destinations:
                        NO NAME [Local] (Last used)
                        Total size: 3.41 GB
                        Total number of backups: (null)
                        Size of backup disk: Too small
                                  Backup size 3.41 GB < (Disk used 136.06 GB X 3)
              Time Machine details may not be accurate.
              All volumes being backed up may not be listed.
    Top Processes by CPU:
                   6%          Activity Monitor
                   5%          WindowServer
                   1%          InterCheck
                   1%          sysmond
                   0%          ocspd
    Top Processes by Memory:
              152 MB          Finder
              115 MB          HelpViewer
              111 MB          mds_stores
              86 MB          InterCheck
              57 MB          WindowServer
    Virtual Memory Information:
              983 MB          Free RAM
              1.03 GB          Active RAM
              584 MB          Inactive RAM
              1.01 GB          Wired RAM
              17.41 GB          Page-ins
              222 MB          Page-outs

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.

  • I have a book in my library but when I went open to continue to read "failed to load book because the requests resource is missing"?  Where is it.

    I have a book in my library but when I went open to continue to read "failed to load book because the requests resource is missing"?  Where is it.

    Swipe to the right from your home screen and do a search. See if the app shows up. If it does - tap on it just to make sure that it works.
    You can swipe from screen to screen to look for it in order to find the icon. It may have ended up on a far off screen or in a folder somewhere on the iPad.

  • Last status is failed but the bios is install successfully

    hi,
    I have win 7 prof 64 bit - clients and active directory on windows 8. on one client i have problem with bios, the bios is in te advertised programs - its install on clients but last status is failed, but installation of bios is successfully, and the
    bios instal again, and again......
    regards

    By default, SCCM considers an error code of 0 successful and anything else a failure (with a couple of exceptions but generally speaking).
    However, remember that the creator of any application you are running doesn't necessarily abide by that.
    For all you know, error code 1073807364
    might mean:
    - Update successful
    - Update successful but restart required
    - Nothing to update (because the computer already has the same BIOS version as what you are trying to install
    - etc..
    You need to figure out exactly what that error code means on the software you are running and if it is the case that that's actually a successful error code, depending on how you are calling it, you either configure SCCM to accept that error code as a success
    or you wrap your main program around a script that transforms that particular code into a 0, which will then be interpreted by SCCM as a success.
    Fausto

  • I cant able to copy my files from my macbook to external hard disk,its showing "read-only",but i can able to transfer files in windows os,why cant i able to do tht in here?

    i cant able to copy my files from my macbook to external hard disk,its showing "read-only",but i can able to transfer files in windows os,why cant i able to do tht in here?

    to frederic1943
             Its in NTFS Format...and i hav downloaded the file NTFS-3G,but still i dont know wht to do with that.will u pls help me here.

  • Managed Metadata (Failed to read from or write to database. Refresh and try again. If the problem persists, please contact the administrator)

    When creating a new site column of the managed meta data type in SharePoint2010, and you select "customize your term set", you are presented with one of the following errors:
    - This operation cannot be completed. The term store may be unavailable.
    - Failed to read from or write to database. Refresh and try again. If the problem persists, please contact the administrator

    Hi,
    I have been facing the same issue, however managed to resolve it.
    This is due to the uncommitted statements. From Powershell try running the following script
    #Connect to Central Admin, Replace the url with the environment specific URL
    $taxonomySite = get-SPSite http://centraladmin:40000
    #Connect to Term Store in the Managed Metadata Service Application, Ensure you put the right Metadate service application name
    $taxonomySession = Get-SPTaxonomySession -site $taxonomySite
    $termStore = $taxonomySession.TermStores["Managed Metadata Service"]
    write-host "Connection made with term store -"$termStore.Name
    #Connect to the Group and Term Set
    $termStore.RollbackAll()
    Hope it would help

Maybe you are looking for

  • Download on new computer?

    Hi, I have Illustrator, Indesign and Photoshop elements. Now I got a new computer and I want these to be installed on the new one. How can I do that? I try to add products to my profile but it says the serialnumber already is registreated even though

  • My apple id is not working

    i tried using the i cloud with my apple id after i updated the software but it is not working and my whats app has also stopped working may i please get some help to resolve the issue as soon as possible

  • HT4009 How to transfer an app made from an in-app purchase to all other idevices

    I downloaded the free version of the app "phone4kids" on iPhone which then Transferred directly to my ipad and iPod touch. I later bought the full version using an in-app purchase. However, even after I synced all devices to iTunes the full version d

  • Importing 16 bit file into 24 bit project

    Whats up guy's When importing a 16 bit file into a 24 bit project should I convert the file to 24 bits or keep the original 16 bit depth? I'm aware that the sample rate is converted to the projects sample rate when importing files as long as the corr

  • How to rotate a video clip 90 degrees?

    I have a video clip that was shot with the camera held sideways, and so the clip is on its side and looks really crappy. How do I rotate it so it looks correct?