Modified the IP address Parser. 51/94451/2
authorsegwon <segwon.han@samsung.com>
Mon, 31 Oct 2016 03:02:13 +0000 (12:02 +0900)
committersegwon <segwon.han@samsung.com>
Tue, 1 Nov 2016 02:18:44 +0000 (11:18 +0900)
Signed-off-by: segwon <segwon.han@samsung.com>
Change-Id: Ib26a8c5d0ca744bcbd30bff0469975f723d54b94

daemon/Util.cpp

index 23add03..0aaeb6e 100755 (executable)
@@ -30,6 +30,8 @@
 #include <pthread.h>
 #include "Service.h"
 
+#define FRONT_PROTOCOL_SIZE 7 // coap://
+
 using namespace std;
 
 std::string conv::util::getBtMacAddress()
@@ -257,9 +259,8 @@ std::string conv::util::getIpAddress(std::string hostAddress)
        if (hostAddress.empty())
                return "";
 
-       std::string::size_type pos  = hostAddress.find(":", 0);
-
-       std::string sub = hostAddress.substr(0, pos);
+       std::string::size_type pos  = hostAddress.find(":", FRONT_PROTOCOL_SIZE);
+       std::string sub = hostAddress.substr(FRONT_PROTOCOL_SIZE, pos - FRONT_PROTOCOL_SIZE);
 
        return sub;
 }