-int p;
-PARAM_VALUE pv;
-vector<PARAM_VALUE>::const_iterator pvi;
-///////////////////////////
-pv.param = "Port";
-pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
- {
- errorStr = "Parameter \'Port\' not found.";
- printfd(__FILE__, "Parameter 'Port' not found\n");
- return -1;
- }
-if (ParseIntInRange(pvi->value[0], 2, 65535, &p))
- {
- errorStr = "Cannot parse parameter \'Port\': " + errorStr;
- printfd(__FILE__, "%s\n", errorStr.c_str());
- return -1;
- }
-port = p;
+ STG::ParamValue pv;
+ std::vector<STG::ParamValue>::const_iterator pvi;
+ ///////////////////////////
+ pv.param = "Port";
+ pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
+ if (pvi == s.moduleParams.end() || pvi->value.empty())
+ {
+ errorStr = "Parameter \'Port\' is not found.";
+ printfd(__FILE__, "%s\n", errorStr.c_str());
+ return false;
+ }
+ int p;
+ if (ParseIntInRange(pvi->value[0], 2, 65535, &p))
+ {
+ errorStr = "Parameter \'Port\' should be an integral value in range (2, 65535). Actual value: '" + pvi->value[0] + "'.";
+ printfd(__FILE__, "%s\n", errorStr.c_str());
+ return false;
+ }
+ m_port = static_cast<uint16_t>(p);
+
+ pv.param = "BindAddress";
+ pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
+ if (pvi != s.moduleParams.end() && !pvi->value.empty())
+ m_bindAddress = pvi->value[0];