Author: samisa
Date: Fri Apr 14 19:37:51 2006
New Revision: 394247

URL: http://svn.apache.org/viewcvs?rev=394247&view=rev
Log:
Added TCPMON trace capability, by default this is off.
Need to use -DAXIS2_TCPMON macro at compile time to enable this

Modified:
    webservices/axis2/trunk/c/modules/util/stream.c

Modified: webservices/axis2/trunk/c/modules/util/stream.c
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/stream.c?rev=394247&r1=394246&r2=394247&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/stream.c (original)
+++ webservices/axis2/trunk/c/modules/util/stream.c Fri Apr 14 19:37:51 2006
@@ -584,6 +584,8 @@
                                                void *buffer, size_t count)
 {
        int len = 0;
+    axis2_char_t *temp  = NULL;
+    
        AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
        
        if(-1 == AXIS2_INTF_TO_IMPL(stream)->socket)
@@ -598,6 +600,19 @@
        }
     
     len = recv(AXIS2_INTF_TO_IMPL(stream)->socket, buffer, count, 0);
+    
+#ifdef AXIS2_TCPMON
+    temp = (axis2_char_t *)AXIS2_MALLOC((*env)->allocator, 
+            (len + 1) * sizeof(axis2_char_t));
+    if (temp)
+    {
+        memcpy(temp, buffer, len * sizeof(axis2_char_t));
+        temp[len] = '\0';
+        fprintf (stderr, "%s", temp);
+        AXIS2_FREE((*env)->allocator, temp);
+        temp = NULL;
+    }
+#endif
     return len;
 }
 
@@ -606,6 +621,7 @@
                                                const void *buffer, size_t 
count)
 {
     int len = 0;
+    axis2_char_t *temp  = NULL;
                        
        AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
        
@@ -618,6 +634,18 @@
        if (NULL == buffer)
                return -1;
        len = send(AXIS2_INTF_TO_IMPL(stream)->socket, buffer, count, 0);
+#ifdef AXIS2_TCPMON
+    temp = (axis2_char_t *)AXIS2_MALLOC((*env)->allocator, 
+            (len + 1) * sizeof(axis2_char_t));
+    if (temp)
+    {
+        memcpy(temp, buffer, len * sizeof(axis2_char_t));
+        temp[len] = '\0';
+        fprintf (stderr, "%s", temp);
+        AXIS2_FREE((*env)->allocator, temp);
+        temp = NULL;
+    }
+#endif
        return len;
        
 }


Reply via email to