Changeset 35027 for platform/mysql
- Timestamp:
- 08/24/09 19:15:04 (4 years ago)
- Files:
-
- 1 modified
-
platform/mysql/mycached/trunk/testclient.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/mysql/mycached/trunk/testclient.cc
r35025 r35027 1 1 extern "C" { 2 #include <arpa/inet.h> 2 3 #include <assert.h> 3 4 #include <fcntl.h> 5 #include <netdb.h> 4 6 #include <netinet/in.h> 5 7 #include <netinet/tcp.h> … … 22 24 static int connections_per_thread = 1; 23 25 static int runs_per_thread = 100000 / num_threads; 26 static struct in_addr host; 24 27 static unsigned short port = 11211; 25 28 … … 71 74 addr.sin_family = AF_INET; 72 75 addr.sin_port = htons(port); 73 addr.sin_addr.s_addr = htonl(0x7f000001);76 memcpy(&addr.sin_addr, &host, sizeof(host)); 74 77 assert(connect(sock, (sockaddr*)&addr, sizeof(addr)) == 0); 75 78 setup_sock(sock); … … 90 93 int ch; 91 94 92 while ((ch = getopt(argc, argv, "t:c:n:p:")) != -1) { 95 host.s_addr = htonl(0x7f000001); 96 97 while ((ch = getopt(argc, argv, "t:c:n:h:p:")) != -1) { 93 98 switch (ch) { 94 99 case 't': … … 100 105 case 'n': 101 106 assert(sscanf(optarg, "%d", &runs_per_thread) == 1); 107 break; 108 case 'h': 109 if (inet_aton(optarg, &host) == 0) { 110 struct hostent* h = gethostbyname(optarg); 111 assert(h != NULL && "host not found"); 112 assert(h->h_addrtype = AF_INET); 113 assert(h->h_length == sizeof(host)); 114 memcpy(&host, h->h_addr_list[0], sizeof(host)); 115 } 102 116 break; 103 117 case 'p':
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)