Changeset 287d729 in mainline for uspace/app/nettest3/nettest3.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/nettest3/nettest3.c
rc55cbbf r287d729 39 39 #include <str.h> 40 40 41 #include <inet/dnsr.h> 41 42 #include <net/in.h> 42 43 #include <net/in6.h> … … 60 61 int fd; 61 62 char *endptr; 63 dnsr_hostinfo_t *hinfo; 62 64 63 65 port = 7; … … 75 77 rc = inet_pton(AF_INET, argv[1], (uint8_t *)&addr.sin_addr.s_addr); 76 78 if (rc != EOK) { 77 fprintf(stderr, "Error parsing address\n"); 78 return 1; 79 /* Try interpreting as a host name */ 80 rc = dnsr_init(); 81 if (rc != EOK) { 82 printf("Failed connecting DNS resolution " 83 "service (%d).\n", rc); 84 return rc; 85 } 86 87 rc = dnsr_name2host(argv[1], &hinfo); 88 if (rc != EOK) { 89 printf("Error resolving host '%s'.\n", argv[1]); 90 return rc; 91 } 92 93 addr.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4); 94 addr.sin_family = AF_INET; 79 95 } 80 96 printf("result: rc=%d, family=%d, addr=%x\n", rc,
Note:
See TracChangeset
for help on using the changeset viewer.