Changeset 287d729 in mainline for uspace/app/nettest2/nettest2.c
- Timestamp:
- 2013-04-25T06:45:04Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fff7ef4
- Parents:
- c55cbbf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nettest2/nettest2.c
rc55cbbf r287d729 47 47 #include <stdbool.h> 48 48 49 #include <inet/dnsr.h> 49 50 #include <net/in.h> 50 51 #include <net/in6.h> … … 71 72 printf( 72 73 "Network Networking test 2 aplication - UDP transfer\n" 73 "Usage: echo [options] address\n"74 "Usage: nettest2 [options] host\n" 74 75 "Where options are:\n" 75 76 "-f protocol_family | --family=protocol_family\n" … … 227 228 struct sockaddr_in address_in; 228 229 struct sockaddr_in6 address_in6; 230 dnsr_hostinfo_t *hinfo; 229 231 socklen_t addrlen; 230 232 uint8_t *address_start; … … 265 267 } 266 268 267 /* If not before the last argument containing the address*/269 /* If not before the last argument containing the host */ 268 270 if (index >= argc) { 269 printf("Command line error: missing address\n");271 printf("Command line error: missing host name\n"); 270 272 nettest2_print_help(); 271 273 return EINVAL; … … 294 296 } 295 297 296 /* Parse the last argument which should contain the address.*/298 /* Parse the last argument which should contain the host/address */ 297 299 rc = inet_pton(family, argv[argc - 1], address_start); 298 300 if (rc != EOK) { 299 fprintf(stderr, "Address parse error %d\n", rc); 300 return rc; 301 /* Try interpreting as a host name */ 302 rc = dnsr_init(); 303 if (rc != EOK) { 304 printf("Failed connecting DNS resolution " 305 "service (%d).\n", rc); 306 return rc; 307 } 308 309 rc = dnsr_name2host(argv[argc - 1], &hinfo); 310 if (rc != EOK) { 311 printf("Error resolving host '%s'.\n", argv[argc - 1]); 312 return rc; 313 } 314 315 address_in.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4); 301 316 } 302 317
Note:
See TracChangeset
for help on using the changeset viewer.