reverted HTTPCLient debug back to defaulted off
Fork of MTS-Socket by
Endpoint.cpp
00001 #include "mbed.h" 00002 #include "Socket.h" 00003 #include "Endpoint.h" 00004 #include "MTSLog.h" 00005 #include <cstring> 00006 00007 using std::memset; 00008 using namespace mts; 00009 00010 Endpoint::Endpoint() 00011 { 00012 reset_address(); 00013 } 00014 00015 Endpoint::~Endpoint() 00016 { 00017 } 00018 00019 void Endpoint::reset_address(void) 00020 { 00021 _ipAddress[0] = '\0'; 00022 _port = 0; 00023 } 00024 00025 int Endpoint::set_address(const char* host, const int port) 00026 { 00027 int length = strlen(host) + 1; // size of host including terminating character 00028 if (length > sizeof(_ipAddress)) { 00029 logError("could not set address because the hostname is too long"); 00030 return -1; 00031 } else { 00032 strncpy((char*) _ipAddress, host, length); 00033 _ipAddress[length] = '\0'; 00034 _port = port; 00035 } 00036 return 0; 00037 } 00038 00039 char* Endpoint::get_address() 00040 { 00041 return _ipAddress; 00042 } 00043 00044 int Endpoint::get_port() 00045 { 00046 return _port; 00047 }
Generated on Wed Jul 13 2022 10:29:47 by 1.7.2