ctb readout works with receiver for digital readout, allocate ram in server only if 1g udp, free addr info only when setting new udp detals upon configuring ,brough readout flags to receiver

This commit is contained in:
2019-02-28 16:07:47 +01:00
parent 96584ce397
commit debf3a1b01
14 changed files with 316 additions and 128 deletions

View File

@ -62,6 +62,7 @@ int setUDPDestinationDetails(const char* ip, unsigned short int port) {
}
int createUDPSocket() {
FILE_LOG(logDEBUG2, ("Creating UDP Socket\n"));
if (!strlen(udpDestinationIp)) {
FILE_LOG(logERROR, ("No destination UDP ip specified.\n"));
return FAIL;
@ -107,10 +108,9 @@ int sendUDPPacket(const char* buf, int length) {
}
void closeUDPSocket() {
close(udpSockfd);
udpSockfd = -1;
if (udpServerAddrInfo) {
freeaddrinfo(udpServerAddrInfo);
udpServerAddrInfo = 0;
if (udpSockfd != -1) {
FILE_LOG(logINFO, ("Udp client socket closed\n"));
close(udpSockfd);
udpSockfd = -1;
}
}