You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2008/06/08 14:51:54 UTC
svn commit: r664495 - /webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
Author: samisa
Date: Sun Jun 8 05:51:54 2008
New Revision: 664495
URL: http://svn.apache.org/viewvc?rev=664495&view=rev
Log:
Fixed AXIS2C-1183. Now it works with empty -lp or -tp without crashing
Modified:
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c?rev=664495&r1=664494&r2=664495&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Sun Jun 8 05:51:54 2008
@@ -70,8 +70,8 @@
{
axutil_env_t *env = NULL;
int c;
- int listen_port = 9090,
- target_port = 8080;
+ int listen_port = 9099,
+ target_port = 9090; /* the default port simple axis2 server is run on 9090 */
int test_bit = 0;
int format_bit = 0;
int ii = 1;
@@ -83,9 +83,9 @@
argv[0]);
fprintf(stdout, " Options :\n");
fprintf(stdout,
- "\t-lp LISTEN_PORT \tport number to listen on, default is 9090\n");
+ "\t-lp LISTEN_PORT \tport number to listen on, default is 9099\n");
fprintf(stdout,
- "\t-tp TARGET_PORT \tport number to connect and re-direct messages, default is 8080\n");
+ "\t-tp TARGET_PORT \tport number to connect and re-direct messages, default is 9090\n");
fprintf(stdout,
"\t-th TARGET_HOST \ttarget host to connect, default is localhost\n");
fprintf(stdout,
@@ -107,50 +107,58 @@
signal(SIGPIPE, sig_handler);
#endif
- target_host = axutil_strdup(env, "localhost");
+ target_host = axutil_strdup(env, "localhost");
while (ii < argc)
{
if (!strcmp("-lp", argv[ii]))
{
ii++;
- listen_port = atoi(argv[ii++]);
- if (listen_port == 0)
+ if (argv[ii])
{
- printf("INVALID value for listen port\n");
- printf("Use -h for help\n");
- AXIS2_FREE(env->allocator, target_host);
- if (env)
+ listen_port = atoi(argv[ii++]);
+ if (listen_port == 0)
{
- axutil_env_free((axutil_env_t *) env);
- env = NULL;
+ printf("INVALID value for listen port\n");
+ printf("Use -h for help\n");
+ AXIS2_FREE(env->allocator, target_host);
+ if (env)
+ {
+ axutil_env_free((axutil_env_t *) env);
+ env = NULL;
+ }
+ return 0;
}
- return 0;
}
-
}
else if (!strcmp("-tp", argv[ii]))
{
ii++;
- target_port = atoi(argv[ii++]);
- if (target_port == 0)
+ if (argv[ii])
{
- printf("INVALID value for target port\n");
- printf("Use -h for help\n");
- AXIS2_FREE(env->allocator, target_host);
- if (env)
+ target_port = atoi(argv[ii++]);
+ if (target_port == 0)
{
- axutil_env_free((axutil_env_t *) env);
- env = NULL;
+ printf("INVALID value for target port\n");
+ printf("Use -h for help\n");
+ AXIS2_FREE(env->allocator, target_host);
+ if (env)
+ {
+ axutil_env_free((axutil_env_t *) env);
+ env = NULL;
+ }
+ return 0;
}
- return 0;
}
}
else if (!strcmp("-th", argv[ii]))
{
ii++;
- AXIS2_FREE(env->allocator, target_host);
- target_host = (char *) axutil_strdup(env, argv[ii++]);
+ if (argv[ii])
+ {
+ AXIS2_FREE(env->allocator, target_host);
+ target_host = (char *) axutil_strdup(env, argv[ii++]);
+ }
}
else if (!strcmp("--test", argv[ii]))
{
@@ -165,7 +173,10 @@
else if (!strcmp("-f", argv[ii]))
{
ii++;
- tcpmon_traffic_log = argv[ii++];
+ if (argv[ii])
+ {
+ tcpmon_traffic_log = argv[ii++];
+ }
}
else
{