feat: Migrating features from newer implementation

This commit is contained in:
2025-03-29 10:50:16 +01:00
parent 171a48eb71
commit 810264aa71
15 changed files with 982 additions and 538 deletions
+21 -18
View File
@@ -43,23 +43,26 @@ bool SPITSocket::createSocket_UDP() {
} else {
intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_REUSEADDR, (void *)&intOptionValue4, sizeof(intOptionValue4));
}
if (intResult < 0) {
boolSuccess = false;
}
// // set the m_UDPSocketIP4 in NON BLOCKING mode because
// // if the UDPSockets are in blocking mode the receiveMessage does not return in every constellation
// int intFlags;
// intFlags = fcntl(m_UDPSocketIP4, F_GETFL);
// fcntl(m_UDPSocketIP4, F_SETFL, intFlags | O_NONBLOCK);
if (boolSuccess == true) {
struct timeval tv;
tv.tv_sec = 1; // seconds
tv.tv_usec = 0; // microseconds (0.0 sec)
// This sets the receive timeout
setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
struct timeval tv;
tv.tv_sec = 1; // seconds
tv.tv_usec = 0; // microseconds (0.0 sec)
// set the m_UDPSocketIP4 in NON BLOCKING mode because
// if the UDPSockets are in blocking mode the receiveMessage does not return in every constellation
// int intFlags;
// intFlags = fcntl(m_UDPSocketIP4, F_GETFL);
// fcntl(m_UDPSocketIP4, F_SETFL, intFlags | O_NONBLOCK);
// This sets the receive timeout
setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
if (intResult < 0) {
boolSuccess = false;
// int intBufferSize = 2046 * 512;
// intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_RCVBUF, (void*)&intBufferSize, sizeof(intBufferSize));
// intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_SNDBUF, (void*)&intBufferSize, sizeof(intBufferSize));
}
return boolSuccess;
}
@@ -72,7 +75,7 @@ bool SPITSocket::createSocket_UDP() {
* @return -1 id bind fails, o if bind is ok
*
*/
int SPITSocket::bindSocket(string p_ClientIP, string p_ClientPort) {
int SPITSocket::bindSocket(string p_ServerIP, string p_ClientIP, string p_ClientPort) {
addrinfo *clientAI;
struct sockaddr_in *ptrIP4SocketAddress;
struct sockaddr_in o_IP4SocketAddress;
@@ -193,9 +196,9 @@ int SPITSocket::sendMessageTo(int p_InetFamily, string p_ServerIP, string p_Serv
intResult = -1;
}
if (intResult == -1) {
return -1;
}
if (intResult < 0) {
return -1;
}
return 0;
}
/**