Trying to detect connection loss

I have built a little telnet program which is specialized for a specific telnet supporting server... Everything works just fine except for detecting connection loss...
I am connected to the server using java.net.Socket, data is sent using java.io.PrintStream and data is received using java.io.InputStream...
I have tried having a thread running and looking if the Socket was still connected, but even after closing the server, the Socket keeps returning true when I call Socket.isConnected()... How could I detect the moment when a connection is broken, would it be because the user has a modem connection and gets disconnected or because the server shuts down or any other such reason?

You can detect a dead socket when a write to it fails.
So, you could periodically send "keep alive" messages
to know approximately when it drops.Okay, I had noticed that the PrintStream would set it's error state to true when I try to send a message and the socket is dead, but I hoped I didn't have to wait until that moment... Thanks though! You confirmed me I'll have to do it that way :P

Similar Messages

  • Detecting Connection Loss

    Hi All,
    I'm working with two computers that are each running a LV program to achieve
    TCP communication. Please see attached LLB. Both PCs are connected via a
    switch that is running a DHCP server.
    My plan was to watch the error cluster from the TCP Read function to ensure
    that the connection is still valid.
    So, to test this, I run the two VIs on the two PCs and I physically
    disconnect the ethernet cable from one of the PCs.
    What I am seeing is that only the PC that is disconnected from the network
    registers and error (error 66). The other PC only registers a timeout
    error.
    My question is, how can I tell from the second PC that the connection has
    been lost. I know that I could use a timer, but I was hoping to avoid that.
    Thanks for you
    help
    Denis

    I do not think there is another way do this than using a timeout. The deal is that the recieving computer monitors a port for data. This is the only way it gets information from the remote computer. It is not like there are status lines to verify connection. You can either wait a reasonable amount of time for the data--if it is not there then timeout, assuming a broken connection. Or you can use TCP to have the previously listen only computer now sending data to the previouly sending only computer. It is indirect, but now there is a two way dependency between the computers and both can detect a broken connection.

  • Trying to detect connection protocol

    Is it possible using GetHttpRequestData or other function to
    readd the URL in the CFML action script to determin if the user is
    using HTTP or HTTPS?
    Any hlp would be appreciated...

    if you test
    cgi.https it should return "on" or "off"
    HTTPS = on
    HTTP = off

  • Windows server 2012 and windows xp remote desktop connection loss

    I am having this problem for a month now, and i am stumped with trying to find an answer . I have talked with several network admins in my area and with no luck i have not found a solution. I have a windows server 2012 placed with 5 pcs that are connected
    on a local network , those 5 pc's connect to the server via remote desktop. List of pc's:
    1x Windows 7
    4x Windows XP SP3
    All have the latests network drivers, all have the latest version of remote desktop installed. All have been scanned for viruses. All have antivirus software.
    Problem is the 4 XP machines lose connection on when connected via remote desktop. If one starts losing connection the other 3 start to lose the connection aswell. The windows 7 machine is not affected by this it works fine.
    What have I tried:
    Scanning for viruses.
    Disabling Firewall and antivirus software.
    Updating all drivers.
    Did many changes to group policy like keepalives etc.
    Turning off SMBv2 SMBv3.
    Turning off network adapter Offload settings.
    Changed some registry settings like keepalive, smb etc.
    Updating every pc and server with all windows updates.
    Changed the router and switch.
    Port forwarded needed ports like 3389.
    Updating remote desktop to 7.0.
    I might be forgetting some stuff i will add as i remember anything.
    So the thing is this. I use a Windows XP machine from my office I remotely connect to the server via the Internet and I DO NOT experience any connection loss. BUT the XP machines on the local network constantly experience connection loss via remote desktop.
    I pinged every Machine from the server via CMD command PING. So when they lose connection the Packets get time outs . Packets get dropped between 1-10 packets when a connection is lost. This packet drop does not occur when using the internet or anything else.
    ONLY when connected to the server via remote desktop. The packets get dropped at random intervals.
    Problem is I use an XP machine and I am not experiencing any loss of connection , while the XP machines on the local network experience it , but not the windows 7 machine.
    Router is ASUS RT-N53 , and switch is Dlink DES-1008D. Server is a Dell PowerEdge T110 II.
    Can someone please tell me what can i do to solve this problem?

    So today got some word from their office. They were using RDP from 8AM until 12PM all was working fine. Then got back after lunch about 1PM and got a few connection lost errors when they tried using RDP again. Its weird since they didn't have disconnects
    in the morning, and started having them after lunch.
    Also noticed, that two pc were not using RDP and were disconnected as shown in task manager. And they still got request timeouts.
    Maybe this is not a remote desktop issue?
    TASK MANAGER
    The 2 disconnected pc's ping screens:

  • Why do I have Intermittent Wifi Connection Loss during music streaming ?

    Hello,
    I have an ipad3 and an iPhone 4S and I am getting with both devices interruption of the sound when I send music to the Apple TV. It generally happens after a few minutes. The signal for the wifi is still good and I have still access to the Internet  I have tried all the recommendations of the article "iOS: Troubleshooting Wi-Fi networks and connections" but this did not help. I have used several applications for sending music to the Apple TV (music application from Apple and DSAudio from Synology) but I'm getting the same issue. I have also the same issue with the media center application from Bouygues Telecom connecting directly to my internet router. My router is a bbox sensation. I had also the same kind of issue with my old router when sensing photo albums to the internet: I had the error message "your system is running low on ressources". How can I solve these intermittent wifi connection losses ?

    Try #5.
    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are droping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Wi-Fi Fix for iOS 6
    https://discussions.apple.com/thread/4823738?tstart=240
    iOS 6 Wifi Problems/Fixes
    How To: Workaround iPad Wi-Fi Issues
    http://www.theipadfan.com/workaround-ipad-wifi-issues/
    Another Fix For iOS 6 WiFi Problems
    http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
    Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    How to Boost Your Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h tm
    Troubleshooting a Weak Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
    How to Fix a Poor Wi-Fi Signal on Your iPad
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
    iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Connect iPad to Wi-Fi (with troubleshooting info)
    http://thehowto.wikidot.com/wifi-connect-ipad
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    Wi-Fi or Bluetooth settings grayed out or dim
    http://support.apple.com/kb/TS1559
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • Connectivity loss between PLC and Kepware

    Hi Experts,
    I m working on SAP PCo and PLC connectivity using Kepware.
    I m trying to find out ways to find connectivity loss between
    1) PLC and kepware
    2) kepware and PCo
    For 2nd approch,if connectivity loss is there then PCo instance will go in error state and using remote monitoring we can get alert.
    But m not able to find any way for 1st approch.
    If PLC connection lost then only tag quality in kepware is bad.
    Is there any way in PCo expression editor to check tag quality so that i can trigger MII transaction?
    Thanks in advance.
    Regards,
    Neha

    To add to Hubrisnsx's comment ... are you provisioned Ethernet or MoCA for the WAN connection?
    Edit: Never mind, I see in the first post you said MoCA.   So, if the MoCA channel is staying up, then it sounds like it might be something inside the ONT. 
    Keep in mind that while some Verizon folks do drop by these forums from time to time, that this is primarily are user to user forum where customers can help one another.

  • I cannot get my iPod Touch to charge. I have tried 3 different connections.

    I cannot get my iPod Touch to charge. I have tried 3 different connections.
    Also, my youngest grandson cannot remember his password. Is there a way to find it?

    Not charging is one of the symptoms covered here:
    iPod touch: Hardware troubleshooting
    To recover from a loss screen passcode, connect the iPod to its syncing computer and restore the iPod from backup via iTunes on the computer.  If iTunes asks for the unknown passcode, place the iPod in recovery mode and then restore the iPod.  For recovery mode see:
    iPhone and iPod touch: Unable to update or restore

  • Folders being closed upon connection loss?

    The issue is that previously it would bring up an error saying that connection was lost and would still show the folders but without any contents, and it would've been possible to do a refresh when you'd have a connection, now it instantly brings to Network folder.
    Update:
    Previously before the OS reinstall, I've tested what's causing the CPU usage to go up so high using ProcessExplorer, and found out that explorer.exe is using too much services/libraries, mainly ntdll.dll, which is being looped constantly, i.o. ntdll.dll would be copied and copied and copied until you'd restart the process (explorer.exe) 

    Hello,I'm currently having an issue with a user that is often on the road and obviously it's often that connection is being lost. That person often opens a lot of folders that we have on our local file server, and as soon as his connection is lost it brings him to the "Network" folder. Any idea what could be the issue? Also CPU would rise up to a %100 in total (File explorer .exe consuming approx. 40-60% because explorer.exe has a looping ntdll.dll library being looped in its process).He uses a Dell XPS 13 ultrabook with a four core i7 processor.Before connection loss:After connection loss:
    OS: 8.1 Pro (Latest updates)File server, DC&AD: Win Server 2012 R2, Folder share.
    What has been tried:sfc /scannowOS reinstall
    This topic first appeared in the Spiceworks Community

  • My iPhone 4 no longer connects to my car or alarm clock after a recent sync to my computer.  The message at I get when trying to. Connect is "this accessory is not optimized for the device" or something like that.  Anyone know how to fix this?

    My iPhone 4 no longer connects to my car or alarm clock after a recent sync to my computer.  The message at I get when trying to. Connect is "this accessory is not optimized for the device" or something like that.  Anyone know how to fix this?

    Hello there philp_69,
    If I understand correctly it sounds like your phone hasnt been recognized in iTunes on your PC since the last couple of updates. I would use the troubleshooting in the following article which will walk you through the steps one by one. 
    iPhone, iPad, or iPod touch not recognized in iTunes for Windows
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Same here, 4s working perfectly, downloaded update 8.0.1 Now no wifi or bluetooth or hotspot. Control on/off icons are muted in colour and don't respond. Tried resetting network connections then total restore, didn't work so still have the same probl

    Same here, 4s working perfectly, downloaded update 8.0.1 Now no wifi or bluetooth or hotspot. Control on/off icons are muted in colour and don't respond. Tried resetting network connections then total restore, didn't work so still have the same problems as before.

    Satellite L505D-S5983
    I would try another restore of the hard disk to its original out-of-the-box contents using Toshiba recovery media. Maybe something went wrong in the process. Make sure everything works before applying any updates and adding any hardware or software.
    Then add things carefully, rebooting Windows and testing the USB and audio at each step.
    Please note this.
    The only info windows gives me for the sound card is that it from Microsoft... with a driver version of 6.1.7601.17514....which naturally doesn't really help me since I have no idea what card or mobo I have . Is there any way for me to find out what I need other than opening up my laptop?
    Every one of them lists my mobo simply as a Toshiba motherboard, with no audio card information. Which I'm assuming that is because it has an internal sound processor. My problem is that none of the properties, or ANYTHING I try, will give me information on what I need to fix this...
    All of the latest drivers for your model are easily found here. This one is for the sound.
       Realtek Audio Driver for Windows 7 (32/64)
    -Jerry

  • I have an Airport Express that I am trying to use connected by ethernet to my iMac G4 running Mac OS 10.4.11.  I need to update the Airport software in order to use security option WPA2 Personal.  I currently have Airport software v. 5.6.1.

    I have an Airport Express that I am trying to use connected by ethernet to my iMac G4 running Mac OS 10.4.11.  I need to update the Airport Express softwart in order to use security option WPA2 Personal to connect to the internet through my Airport Extreme.  I currently have Airport Express software version 5.6.1.  How can I update this software? (I can connect directly to my Airport Extreme by ethernet and download the update that way).  Is a later version of A E software available for download anywhere?   Any suggestions would be greatly appreciated.
    Thanks.

    Download and install AirPort Utility 5.4.2 for Mac OS X 10.4.11 "Tiger" here:
    AirPort Utility 5.4.2
    Once installed, launch AirPort Utility. It will tell you if a firmware upgrade is available for your Express.

  • Connection loss SUM GUI to SL Controller

    Hi experts,
    I am experiencing an issue that I need to resolve. It is that I lose the connection from SUM GUI (locally) to the SL Controller running on the remote server.
    Currently I am doing an upgrade and after some time, e.g. when I have an error and don't notice it immediately, I get a warning message.
    "The connection to the SL Controller is down.
    The SDT GUI will reestablish the connection, when possible."
    On the server I get the following error message:
    May 26, 2014 7:49:47 AM [Error]: com.sap.sdt.engine.core.communication.FactoryAlreadyRegisteredException: Factory for key 'com.sap.sdt.engine.core.com
    munication.FactoryKey@13c2c5f4' is already registered.
    May 26, 2014 7:49:47 AM [Error]: com.sap.sdt.engine.core.communication.FactoryAlreadyRegisteredException: Factory for key 'com.sap.sdt.engine.core.com
    munication.FactoryKey@13c2c5f4' is already registered.
    May 26, 2014 7:49:47 AM [Error]: com.sap.sdt.server.core.ServerException
    May 26, 2014 7:49:51 AM [Warning]: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    May 26, 2014 7:49:51 AM [Warning]: Error while closing connection.
    May 26, 2014 7:49:51 AM [Error]: com.sap.sdt.engine.core.communication.SendException: Error while sending data.
    Network input/output exception has occurred: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    java.net.SocketException: Broken pipe
    May 26, 2014 7:49:51 AM [Error]: com.sap.sdt.engine.core.communication.SendException: Error while sending data.
    Network input/output exception has occurred: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    javax.net.ssl.SSLException: java.net.SocketException: Broken pipe
    java.net.SocketException: Broken pipe
    My current assumption is that the firewall drops the connection due to inactivity.
    The main issue then is:
    although I restart my local SUM GUI and reconnect to the server I can't continue the upgrade because the Buttons are "unclickable" (grey).
    Currently I always had to restart SUM including the services on ther server (SL controller).
    My question is:
    what can I do to avoid this connection loss?
    Is there a option to set a "keep alive" to the network connection?
    so that the firewall does not validate the connection as idle and drops?
    Unfortunately we can't do much about the firewall settings due to security restrictions.
    I would be glad to hear from you.
    Kind regards,
    Niklas

    Hi Mathias,
    I got an answer from SAP. There is no option that can be executed with STARTUP to solve this.
    I already proposed to forward this request to the dev team at SAP
    What I am currently doing is:
    Start the GUI and keep it open only if I know if there is are Actions coming next, otherwise I close it (only the GUI) and when some time has passed by I logon again to check.
    This is a really bad solution, but currently the only one.
    Regards,
    Niklas

  • Web service proxy take ~4 minutes to detect connection problem in AIX!

    Dear All,
    i am developing a client application that consume web service , by jdeveloper 10.1.3.1.
    i found a problem, in AIX, that the web service proxy generated by jdeveloper take long time
    to detect connection problem to the server (e.g. server is down, network down, invalid
    ip address or port supplied).
    in ms window, if the proxy can't reach the server, it throw exception within seconds.
    but in ibm AIX, it take about 4 minutes !!! the time is too long until the exception is thrown.
    could anybody help me?
    is there something i can set to greatly shorten the hanging time when connection
    problem?
    thank you.

    nobody experience this problem?

  • My ipod 4G won't connect to my wifi at home with new router. Says "unable to connect" and won't give me any other options. Have tried resetting network connections. Help.

    My ipod 4G won't connect to my wifi at home with new router. Says "unable to connect" and won't give me any other options. Have tried resetting network connections. I don't want to lose anything. I have tried turning everything off and back on again. Desktop and laptop are working fine. Sometimes it turns on suddenly and I can use it for like 20 mins but then shuts off again. Same thing is happening with my dad's iphone, Help.

    Does the iOS device connect to other networks?
    Does the iOS device see the network?
    Any error messages?
    Do other devices now connect?
    Did the iOS device connect before?
    Try the following to rule out a software problem:                 
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on your router
    .- Reset network settings: Settings>General>Reset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - Wi-Fi: Unable to connect to an 802.11n Wi-Fi network       
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    If still problem and it does not connect to any networks make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar

  • HT204368 No Bluetooth devises appear while IPhone is trying to detect, what's wrong ?

    No Bluetooth devises appear while IPhone is trying to detect, what's wrong ?
    In addition the Bluetooth sign on the upper part of the IPhone appears only when I enter the Bluetooth setting.
    Is this part of IOS 6.1 changes?

    TNX, but this is not the case.
    Anyone ?

Maybe you are looking for

  • I entered someone in my contacts but they do not show up in my list.

    They do show up when they call and text me. I cannot access the contact from my list even when I search for them and have turned on the function to show contacts from all sources. When I type in the number manually their name shows up. Since I cannot

  • WBS Element on AR/AP Line Item Report

    Hi All When I run the FBL1n report for a vendor who has a PO which has a WBS element - I dont see the WBS element coming up on the line item report(s). Although the field is there on the layout - it is not picking the WBS Element into the report - ca

  • How to draw custom line in crystal report without manually entering value?

    Hi, I have a bubble chart and want to represent custom lines one in x-axis and one in y-axis at the value arrived based upon an internal calculation.There is an option to manually enter value for custom line. But i want to generate custom line at run

  • Error releasing a billing document to accounting - Billing Plan error

    Hello, I recently encountered a problem with releasing a billing document to accounting. When I click the release to accounting button in VF02 I would get this message "Billing plan 0000057337 does not exist - Program error". Here are my findings thu

  • Sleep issues

    My mac mini sleeps when I turn off my TV though it's preferences are set to not sleep. How can I change this, what com.plist do I have to delete? This is something new that just started on Monday. I swear the thing has a mind of it's own. I would lik