@@ -94,14 +94,16 @@ int main(int argc, char **argv) {
94
94
(" response-timeout" ,
95
95
" set the timeout interval in seconds used to wait for a response. "
96
96
" When a byte timeout is set, if elapsed time for the first byte of response is longer than "
97
- " the given timeout, the a timeout is detected."
97
+ " the given timeout, a timeout is detected."
98
98
" When byte timeout is disabled, the full confirmation response must be received before "
99
99
" expiration of the response timeout."
100
100
" Fractional values are possible." ,
101
101
cxxopts::value<double >())
102
+ #ifdef OS_LINUX
102
103
(" t,tcp-timeout" ,
103
104
" tcp timeout in seconds. Set to 0 to use the system defaults (not recommended)." ,
104
105
cxxopts::value<std::size_t >()->default_value (" 5" ))
106
+ #endif
105
107
(" h,help" ,
106
108
" print usage" )
107
109
(" version" ,
@@ -140,7 +142,11 @@ int main(int argc, char **argv) {
140
142
141
143
// print usage
142
144
if (args.count (" version" )) {
143
- std::cout << PROJECT_NAME << ' ' << PROJECT_VERSION << std::endl;
145
+ std::cout << PROJECT_NAME << ' ' << PROJECT_VERSION
146
+ #ifndef OS_LINUX
147
+ << " -nonlinux"
148
+ #endif
149
+ << std::endl;
144
150
exit (EX_OK);
145
151
}
146
152
@@ -184,7 +190,11 @@ int main(int argc, char **argv) {
184
190
slave = std::make_unique<Modbus::TCP::Slave>(args[" ip" ].as <std::string>(),
185
191
args[" port" ].as <uint16_t >(),
186
192
mapping.get_mapping (),
193
+ #ifdef OS_LINUX
187
194
args[" tcp-timeout" ].as <std::size_t >());
195
+ #else
196
+ 0 );
197
+ #endif
188
198
slave->set_debug (args.count (" monitor" ));
189
199
} catch (const std::runtime_error &e) {
190
200
std::cerr << e.what () << std::endl;
@@ -196,7 +206,7 @@ int main(int argc, char **argv) {
196
206
try {
197
207
if (args.count (" response-timeout" )) { slave->set_response_timeout (args[" response-timeout" ].as <double >()); }
198
208
199
- if (args.count (" byte-timeout" )) { slave->set_response_timeout (args[" byte-timeout" ].as <double >()); }
209
+ if (args.count (" byte-timeout" )) { slave->set_byte_timeout (args[" byte-timeout" ].as <double >()); }
200
210
} catch (const std::runtime_error &e) {
201
211
std::cerr << e.what () << std::endl;
202
212
exit (EX_SOFTWARE);
0 commit comments