Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/InstanceSubscribe.cpp (1 of 11 files). Show all
Unified · Split
| @@ -37,6 +37,7 @@ int main(int argc, char* argv[]) · 36 unmodified lines | |||
| 37 | { | 37 | { |
| 38 | string hostname; | 38 | string hostname; |
| 39 | uint16_t port; | 39 | uint16_t port; |
| 40 | bool usePortOffset = false; | ||
| 40 | 41 | ||
| 41 | // Ensure that the necessary | 42 | // Ensure that the necessary |
| 42 | // command line arguments are given. | 43 | // command line arguments are given. |
| @@ -51,12 +52,15 @@ int main(int argc, char* argv[]) · 8 unmodified lines | |||
| 51 | hostname = argv[1]; | 52 | hostname = argv[1]; |
| 52 | stringstream(argv[2]) >> port; | 53 | stringstream(argv[2]) >> port; |
| 53 | 54 | ||
| 55 | if (argc > 3) | ||
| 56 | usePortOffset = ParseBoolean(argv[3]); | ||
| 57 | |||
| 54 | // Initialize the subscribers. | 58 | // Initialize the subscribers. |
| 55 | for (uint32_t i = 0; i < TotalInstances; i++) | 59 | for (uint32_t i = 0; i < TotalInstances; i++) |
| 56 | { | 60 | { |
| 57 | // Maintain the life-time of SubscriberHandler instances within main | 61 | // Maintain the life-time of SubscriberHandler instances within main |
| 58 | SubscriberHandler* subscriber = new SubscriberHandler("Subscriber " + ToString(i + 1)); | 62 | SubscriberHandler* subscriber = new SubscriberHandler("Subscriber " + ToString(i + 1)); |
| 59 | subscriber->Initialize(hostname, port); | 63 | subscriber->Initialize(hostname, port + static_cast<uint16_t>(usePortOffset ? i : 0)); |
| 60 | 64 | ||
| 61 | switch (i) | 65 | switch (i) |
| 62 | { | 66 | { |