How to know what causes SocketException to be thrown ?
Hello Javatizers,
I use the following code to check if the socket connection is closed abnormally from the client or not.
try {
.this.dos.write(m); //DataOutputStream
} catch (SocketException se) {
String msg = se.getMessage();
if (msg != null && msg.contains("Connection reset")) {
//handle here
} else {
se.printStackTrace();
} catch (Exception otherExceptions) { /*handle other exceptions*/ } My question is, can I depend on the exception message "Connection Reset" to check such case? Although it is working fine, but I think this is not a good approach checking the message contents !!, or is there any other way to know that the connection is reset? The doc says this exception is thrown to indicate that there is an error in the underlying protocol, such as a TCP error, but i think this is not enough !!
I hope I clarified my idea
Thanks
MohdSleem wrote:
Thanks for your reply
I am using this code into a network game server and there is a lot of possibilities of client shutdown (normal exit, internet went down, process killed,...etc), I use Runtime.getRuntime().addShutdownHook(....) on the client side to send a notification to the server that the client is existing, but the notification delivery is not guaranteed, I have no logical issues with the code above, but I ask to know if there is a better way to do it, I am sure it is a bad design to depend on the exception message :)Correct. It's usually bad.
I still don't get why it matters how or why the user got disconnected.
Similar Messages
-
My iPhone 4 just went black all of the sudden. I can't get it to turn back on and the battery wasn't dead. Anyone know what causes this and how to get it back on?
This has happend to my ipod once...
did u keep it somewhere so tightly pressed??
that might be a reason. Don't worry it will turn on after some time, try connecting it to your computer or charger and see if it helps!!... -
Every once in awhile while using safari my bookmarks list disappears. Later it just shows up again. Anyone know what causes this and how to fix it?
I have had exactly the same problem now with two mini iPads. Everything was tried; 1) restarting; 2) restoring factory settings etc. NONE worked. Eventually Apple agreed to replace it. I have had the replacement now for two to three months and exactly the same thing is happening again. So off to Apple tomorrow to get another replacement.
I am quite a heavy user of the iPad so wonder if this is something to do with the fault.
It is so frustrating as sometimes reset works, and then after 10/20/30/40 minutes (you pick) it goes unstable again. -
How to know what were line item dimensions
Dear SDN,
How to know what were made line item dimensions.
Thankyou.Rahul,
Go to the edit mode of your info cube and then check out your dimensions, there if the line item dimension check box is checked then it means that, that particular dimension is a Line item dimension.
Regards,
Gattu -
HT5457 How I know what model is my iPad ?
How I know what model is my iPad
Go to support.apple.com/kb/HT5452
I hope I helped!!! -
How to know what are all the Webservices available in P6V7
Hi All,
How to know what are the webservices available for integration in P6V7?
Thanks,
RRInformation on Web Services for P6 are available in the Reference Manual that get installed along with P6 Web Service software. you will find the complete list there.
Sachin -
How to know what reports are running by looking at SSReproting Services to see what reports are running and also any clue of which application is using the reporting services?
To see what reports are running, take a look at the execution log views that are available in the database. Which views that are available are dependent on your version of SSRS.
http://technet.microsoft.com/en-us/library/ms159110.aspx
To see which application is using SSRS is a little more difficult. You can turn HTTP logging on, which will give you an idea of where connections are coming from, so you can see IP addresses. You can also look at the execution log view to see
user accounts. So, depending on your environment and use of service accounts, this could be easy, or difficult.
http://technet.microsoft.com/en-us/library/bb630443.aspx
If all else fails you can look for clues in the SSRS logs. Good luck... -
How i know what my collection in adobe ?..
Hello !
week ago i buy my first mac
and the people give me some collection of adobe about 16 software.
he say it's all the softwares adobe has..
but theres no after effects that i really need.
i search in the adobe site the collection of mine..
i think it's the premium beacuse all the software in the premium i have (just not premier and after effects).
how i know what my collection ? and how to download after effects if it's the premium collection ?
thank, tom.Hi Helen,
At the Apple Icon at top left>About this Mac, then click on More Info, then click on Software>Applications.
Unless you mean the OS version, then the Apple Icon at top left>About this Mac will tell you. -
How I know what stored in my iCloud
How I know what stored in my iCloud?
Check Settings>iCloud>Storage & Backup>Manage Storage. If you want to see the actual data, look in the apps on your device that correspond to the data you are syncing (mail, contacts, calendars, notes, reminders, etc.).
-
How to know what database components have been installed on my database?
How to know what database components that have been installed on my database using SQL*PLUS tool? (10g 10.2.0)
Edited by: frank.qian on Nov 8, 2008 10:55 PMHi..
>
SQL> select comp_name,comp_id,version,status from dba_registry;
select comp_name,comp_id,version,status from dba_registry
The error on the first line:
ORA-00942:The table or view not exis.
>
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
sys >desc dba_registry
Name Null? Type
COMP_ID NOT NULL VARCHAR2(30)
COMP_NAME VARCHAR2(255)
VERSION VARCHAR2(30)
STATUS VARCHAR2(11)
MODIFIED VARCHAR2(20)
NAMESPACE NOT NULL VARCHAR2(30)
CONTROL NOT NULL VARCHAR2(30)
SCHEMA NOT NULL VARCHAR2(30)
PROCEDURE VARCHAR2(61)
STARTUP VARCHAR2(8)
PARENT_ID VARCHAR2(30)
OTHER_SCHEMAS VARCHAR2(4000)
sys >select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry;
COMP_ID COMP_NAME VERSION STATUS
CATALOG Oracle Database Catalog Views 10.2.0.4.0 VALID
CATPROC Oracle Database Packages and T 10.2.0.4.0 VALID
ypes
OWM Oracle Workspace Manager 10.2.0.4.3 VALID
JAVAVM JServer JAVA Virtual Machine 10.2.0.4.0 VALID
XML Oracle XDK 10.2.0.4.0 VALID
CATJAVA Oracle Database Java Packages 10.2.0.4.0 VALID
EXF Oracle Expression Filter 10.2.0.4.0 VALID
ODM Oracle Data Mining 10.2.0.4.0 VALID
CONTEXT Oracle Text 10.2.0.4.0 VALID
XDB Oracle XML Database 10.2.0.4.0 VALID
RUL Oracle Rules Manager 10.2.0.4.0 VALID
ORDIM Oracle interMedia 10.2.0.4.0 VALID
APS OLAP Analytic Workspace 10.2.0.4.0 VALID
XOQ Oracle OLAP API 10.2.0.4.0 VALID
AMD OLAP Catalog 10.2.0.4.0 VALID
SDO Spatial 10.2.0.4.0 VALID
EM Oracle Enterprise Manager 10.2.0.4.0 VALID -
switch (msg) {
case WM_NOTIFY:
NMHDR* nmhdr = (LPNMHDR)lparam;
switch(nmhdr->code) {
case TTN_LINKCLICK:
<code>
return TRUE;
I'm able to trap the TTN_LINKCLICK notification. However I would like to retrieve the URL text link that was clicked.
How to know what link is clicked on a Balloon tooltip after handle the TTN_LINKCLICK message ?
MCunhaBasically you don't know what link was clicked. If you need more than one link, you may need to use a different UI element to display it, like a dialog or some sort of other popup window that you have control over.
-
HT1338 how i know what software is in my mac
how i know what software is in my mac
Hi Helen,
At the Apple Icon at top left>About this Mac, then click on More Info, then click on Software>Applications.
Unless you mean the OS version, then the Apple Icon at top left>About this Mac will tell you. -
How to know what CBO programs uses transaction codes
Hello Everyone,
How to know what CBO programs uses transaction codes?
Thanks for the help!Hi,
Please clarify your question ....
for e.g. give program name -
How to know what are the privs for one custom schema?
how to know what are the privs for one custom schema?
please suggest me......Hi,
Check this user_sys_privs
Cheers
Pavan Kumar N -
How to know what applications are currently running !!
how to know what applications are currently running !!
if it is in linux use "ps(Process Status)" command to know what is running currently.... for more see this link
http://www.computerhope.com/unix/ups.htm
Maybe you are looking for
-
How do I delete Photo Stream from Win XP PC
I have turned off Photo Steam on one of my 2 iPads, and both iphones, and should only have 30 pics in Photo Stream from the 1st iPad. However, when I look at photo stream on Apple TV, I have all of the photos that were ever in photo stream (hundreds)
-
Setting up sparse disk image on external drive
I am trying to set up an sparse disk image on an external drive and I am not getting the standard screen that I have seen referenced. My only options to select are image format and encryption, not image size, etc. I have the external drive formatted
-
How to generate 3dSurface plot starting from x,y,z txt file
Hallo guys, I need to generate a 3Dsurface plot starting from unordered coordinates data available in the following text file: xs, ys, zs -20,-70,1500 -30,-55,1500 -30,-79,1500 -40,-70,1500 -10,-70,2000 -30,-42,2000 -30,-90,2000 -53,-70,2000 -5,-
-
How to switch from Aperture 3 to iPhoto 11?
Hello, what is the best method to switch from Aperture 3.x to iPhoto 11? I have about 5000 photos grouped by albums an projects in my Aperture library and would like to move them all to iPhoto 11 as I don't need the pro features of Aperture any longe
-
HI Experts, I need to check a condition in map if (sourceSchema.node2=="datathere") then I need to map the (sourceSchema.node3 to desinationSchema.Out3). I have done this using scripting functoid(where condition is checked and returns Bool) mapped to