#include "ParticipantSocket.h" #include namespace RoboidControl { ParticipantSocket::ParticipantSocket(const char* ipAddress, int port) { // make a copy of the ip address string int addressLength = (int)strlen(ipAddress); int stringLength = addressLength + 1; char* addressString = new char[stringLength]; #if defined(_WIN32) || defined(_WIN64) strncpy_s(addressString, stringLength, ipAddress, addressLength); // Leave space for null terminator #else strncpy(addressString, ipAddress, addressLength); #endif addressString[addressLength] = '\0'; this->ipAddress = addressString; this->port = port; } }