]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmacm/examples: add option to manually set port number
authorDotan Barak <dotanb@dev.mellanox.co.il>
Tue, 8 Apr 2008 19:50:14 +0000 (12:50 -0700)
committerSean Hefty <sean.hefty@intel.com>
Tue, 8 Apr 2008 19:50:14 +0000 (12:50 -0700)
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
examples/cmatose.c
examples/udaddy.c

index 2f6e5f64f0d9f2351e7df6b090849c3c77cff104..ba6299ebc4fbccabf54c0c282b97e7dac1a77045 100644 (file)
@@ -80,6 +80,7 @@ static struct cmatest test;
 static int connections = 1;
 static int message_size = 100;
 static int message_count = 10;
+static uint16_t port = 7471;
 static uint8_t set_tos = 0;
 static uint8_t tos;
 static uint8_t migrate = 0;
@@ -536,7 +537,7 @@ static int run_server(void)
        } else
                test.src_in.sin_family = PF_INET;
 
-       test.src_in.sin_port = 7471;
+       test.src_in.sin_port = port;
        ret = rdma_bind_addr(listen_id, test.src_addr);
        if (ret) {
                printf("cmatose: bind address failed: %d\n", ret);
@@ -613,7 +614,7 @@ static int run_client(void)
        if (ret)
                return ret;
 
-       test.dst_in.sin_port = 7471;
+       test.dst_in.sin_port = port;
 
        printf("cmatose: connecting\n");
        for (i = 0; i < connections; i++) {
@@ -666,7 +667,7 @@ int main(int argc, char **argv)
 {
        int op, ret;
 
-       while ((op = getopt(argc, argv, "s:b:c:C:S:t:m")) != -1) {
+       while ((op = getopt(argc, argv, "s:b:c:C:S:t:p:m")) != -1) {
                switch (op) {
                case 's':
                        dst_addr = optarg;
@@ -687,6 +688,9 @@ int main(int argc, char **argv)
                        set_tos = 1;
                        tos = (uint8_t) atoi(optarg);
                        break;
+               case 'p':
+                       port = atoi(optarg);
+                       break;
                case 'm':
                        migrate = 1;
                        break;
@@ -698,6 +702,7 @@ int main(int argc, char **argv)
                        printf("\t[-C message_count]\n");
                        printf("\t[-S message_size]\n");
                        printf("\t[-t type_of_service]\n");
+                       printf("\t[-p port_number]\n");
                        printf("\t[-m(igrate)]\n");
                        exit(1);
                }
index 76f9ad79020cdb54cad842b2578c4d4ec9185509..0d69b051011e14f6c9f30cdfca4d127331922234 100644 (file)
@@ -74,6 +74,7 @@ static struct cmatest test;
 static int connections = 1;
 static int message_size = 100;
 static int message_count = 10;
+static uint16_t port = 7174;
 static uint8_t set_tos = 0;
 static uint8_t tos;
 static char *dst_addr;
@@ -542,7 +543,7 @@ static int run_server(void)
        } else
                test.src_in.sin_family = PF_INET;
 
-       test.src_in.sin_port = 7174;
+       test.src_in.sin_port = port;
        ret = rdma_bind_addr(listen_id, test.src_addr);
        if (ret) {
                printf("udaddy: bind address failed: %d\n", ret);
@@ -595,7 +596,7 @@ static int run_client(void)
        if (ret)
                return ret;
 
-       test.dst_in.sin_port = 7174;
+       test.dst_in.sin_port = port;
 
        printf("udaddy: connecting\n");
        for (i = 0; i < connections; i++) {