continued win bridge

This commit is contained in:
Robin Müller 2020-09-06 09:54:22 +02:00
parent 08ffbfefae
commit 0c85b05aca
2 changed files with 22 additions and 6 deletions

View File

@ -19,8 +19,8 @@ TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId,
// Set up UDP socket: https://man7.org/linux/man-pages/man7/ip.7.html
//clientSocket = socket(AF_INET, SOCK_DGRAM, 0);
serverSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(socket < 0) {
sif::error << "TmTcUnixUdpBridge::TmTcUnixUdpBridge: Could not open"
if(serverSocket != 0) {
sif::error << "TmTcWinUdpBridge::TmTcWinUdpBridge: Could not open"
" UDP socket!" << std::endl;
handleSocketError();
return;
@ -32,7 +32,7 @@ TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId,
//serverAddress.sin_addr.s_addr = inet_addr("127.73.73.0");
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);
serverAddress.sin_port = htons(setServerPort);
//serverAddressLen = sizeof(serverAddress);
serverAddressLen = sizeof(serverAddress);
setsockopt(serverSocket, SOL_SOCKET, SO_REUSEADDR,
reinterpret_cast<const char*>(&serverSocketOptions),
sizeof(serverSocketOptions));
@ -40,7 +40,7 @@ TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId,
clientAddress.sin_family = AF_INET;
clientAddress.sin_addr.s_addr = htonl(INADDR_ANY);
clientAddress.sin_port = htons(setClientPort);
//clientAddressLen = sizeof(clientAddress);
clientAddressLen = sizeof(clientAddress);
int result = bind(serverSocket,
reinterpret_cast<struct sockaddr*>(&serverAddress),
@ -54,4 +54,20 @@ TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId,
}
}
TmTcWinUdpBridge::~TmTcWinUdpBridge() {}
void TmTcWinUdpBridge::handleSocketError() {
}
void TmTcWinUdpBridge::handleBindError() {
}
ReturnValue_t TmTcWinUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
return HasReturnvaluesIF::RETURN_OK;
}
void TmTcWinUdpBridge::checkAndSetClientAddress(sockaddr_in clientAddress) {
}
void TmTcWinUdpBridge::handleSendError() {
}

View File

@ -28,10 +28,10 @@ private:
const int serverSocketOptions = 0;
struct sockaddr_in clientAddress;
//socklen_t clientAddressLen = 0;
int clientAddressLen = 0;
struct sockaddr_in serverAddress;
//socklen_t serverAddressLen = 0;
int serverAddressLen = 0;
//! Access to the client address is mutex protected as it is set
//! by another task.