+ OCConnectivityType connectivityType = OC_IPV4;
+
+ if(argc == 2)
+ {
+ try
+ {
+ std::size_t inputValLen;
+ int optionSelected = std::stoi(argv[1], &inputValLen);
+
+ if(inputValLen == strlen(argv[1]))
+ {
+ if(optionSelected == 0)
+ {
+ connectivityType = OC_IPV4;
+ }
+ else if(optionSelected == 1)
+ {
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ // connectivityType = OC_IPV6;
+ connectivityType = OC_IPV4;
+ std::cout << "IPv6 not currently supported. Using default IPv4" << std::endl;
+ }
+ else
+ {
+ std::cout << "Invalid connectivity type selected. Using default IPv4"
+ << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "Invalid connectivity type selected. Using default IPv4" << std::endl;
+ }
+ }
+ catch(std::exception& )
+ {
+ std::cout << "Invalid input argument. Using IPv4 as connectivity type" << std::endl;
+ }
+ }
+ else
+ {
+ std::cout<< "Usage simpleclientserver <ConnectivityType(0|1)>" << std::endl;
+ std::cout<< " ConnectivityType: Default IPv4" << std::endl;
+ std::cout << " ConnectivityType : 0 - IPv4" << std::endl;
+ std::cout << " ConnectivityType : 1 - IPv6 (not currently supported)" << std::endl;
+ }
+