javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp
branchRCL_3
changeset 77 7cee158cb8cd
parent 19 04becd199f91
--- a/javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp	Tue Sep 14 21:06:50 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src/nativesocketconnection.cpp	Wed Sep 15 12:05:25 2010 +0300
@@ -187,7 +187,24 @@
             struct hostent* hp = gethostbyname(mHost);
             if (hp ==  NULL)
             {
-                return -(h_errno);
+                 //error condition, we have to handle -18 error.
+                ELOG1(ESOCKET,"NativeSocketConnection:: gthostbyname error : %d" , h_errno);                 
+                int tmp = ApnSettings::retryConnection(h_errno,aType,aApn);
+                if(tmp == 0)
+                {
+                    // connection reset done, attempt once again
+                    hp = gethostbyname(mHost);
+                    if(hp == NULL)
+                    {
+                        return -(h_errno);    
+                    }
+                 }
+                 else
+                 {
+                     // retry not supported/failed
+                     return tmp; 
+                  
+                 }
             }
             addr.sin_addr.s_addr = ((struct in_addr*)(hp->h_addr))->s_addr;
         }