("help,h", "produce help message")
("verbose,v", "be verbose")
("udp-first,u", "try UDP first")
+ ("file,f", po::value<string>(), "source file - if not specified, defaults to stdin")
("tcp-no-delay", po::value<bool>()->default_value(true), "use TCP_NODELAY socket option")
("timeout-msec", po::value<int>()->default_value(10), "wait for this amount of milliseconds for an answer")
("workers", po::value<int>()->default_value(100), "number of parallel workers");
pthread_t workers[numworkers];
- FILE* fp=fdopen(0, "r");
+ FILE* fp;
+ if(!g_vm.count("file"))
+ fp=fdopen(0, "r");
+ else {
+ fp=fopen(g_vm["file"].as<string>().c_str(), "r");
+ if(!fp)
+ unixDie("Unable to open "+g_vm["file"].as<string>()+" for input");
+ }
pair<string, string> q;
string line;
while(stringfgets(fp, line)) {
SYNOPSIS
--------
-'dnstcpbench' [--help] [--verbose] [--udp-first, -u] [--workers] [--timeout-msec] remote-ip-address [remote-port]
+'dnstcpbench' [--help] [--file=filename] [--verbose] [--udp-first, -u] [--workers] [--timeout-msec] remote-ip-address [remote-port]
\r
DESCRIPTION
-----------
-dnstcpbench reads DNS queries from standard input and sends them out in\r
-parallel to a remote nameserver. By default TCP/IP is used, but optionally,\r
-UDP is tried first, which allows for the benchmarking of TCP/IP fallback.\r
+dnstcpbench reads DNS queries (by default from standard input) and sends\r
+them out in parallel to a remote nameserver. By default TCP/IP is used, but\r
+optionally, UDP is tried first, which allows for the benchmarking of TCP/IP\r
+fallback.\r
\r
The input format is one query per line: qname single-space qtype. An\r
example:\r
\r
OPTIONS
-------
-
---verbose::
- Be wordy on what the program is doing
+\r
+-f,--file::\r
+ Filename from which to read queries. Defaults to standard input if\r
+ unspecified.\r
+\r
+-h,--help::\r
+ Provide a helpful message\r
+\r
+--timeout-msec::\r
+ Number of milliseconds to wait for an answer
--udp-first, -u::
Attempt resolution via UDP first, only do TCP if truncated answer is\r
received
\r
+-v,--verbose::
+ Be wordy on what the program is doing
+\r
--workers::\r
Number of parallel worker threads to use. \r
\r
---timeout-msec::\r
- Number of milliseconds to wait for an answer
-\r
---help::\r
- Provide a helpful message\r
\r
Remote IP address can be IPv4 or IPv6. Remote port defaults to 53.\r
\r