24 lines
648 B
C++
24 lines
648 B
C++
#include "ParticipantSocket.h"
|
|
|
|
#include <string.h>
|
|
|
|
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;
|
|
}
|
|
|
|
} |