Working compile copy.

This commit is contained in:
Brad Arant committed 2019-03-04 13:08:34 -08:00
1 parent 41ff757f09
commit f894f3fb66
54 files changed
+249 -355

No files matched your search

+9 -6
View File
@@ -3,8 +3,7 @@
namespace core {
IPAddress::IPAddress() {
addressLength = sizeof(struct sockaddr_in);
pointer = (sockaddr *)&address;
addressLength = sizeof(addr);
}
IPAddress::IPAddress(std::string address) {
@@ -16,19 +15,23 @@ namespace core {
IPAddress(url, port);
}
IPAddress::IPAddress(std::string address, short int port) {
struct sockaddr_in addr;
IPAddress::IPAddress(std::string address, int port) {
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
struct hostent *hp = gethostbyname(address.c_str());
memcpy((void *)&addr.sin_addr, hp->h_addr_list[0], hp->h_length);
addressLength = sizeof(addr);
}
IPAddress::~IPAddress() {
}
struct sockaddr * IPAddress::getPointer() {
return (sockaddr *)&addr;
}
std::string IPAddress::getClientAddress() {
std::string result;
return result;
@@ -36,8 +39,8 @@ namespace core {
std::string IPAddress::getClientAddressAndPort() {
std::stringstream out;
out << inet_ntoa(address.sin_addr);
out << ":" << address.sin_port;
out << inet_ntoa(addr.sin_addr);
out << ":" << addr.sin_port;
return out.str();
}