@@ -509,8 +509,8 @@ int UDPOutput::SendMessages(unsigned int socketKey, SendSocketInfo* socketInfo,
509
509
}
510
510
++errCount;
511
511
if (errCount >= 10 ) {
512
- LogErr (VB_CHANNELOUT, " sendmmsg() failed for UDP output (key : %X Socket: %d output count: %d/%d) with error: %d %s\n " ,
513
- socketKey, sendSocket,
512
+ LogErr (VB_CHANNELOUT, " sendmmsg() failed for UDP output (IP : %s Socket: %d output count: %d/%d) with error: %d %s\n " ,
513
+ HexToIP ( socketKey). c_str () , sendSocket,
514
514
outputCount, msgCount,
515
515
errno,
516
516
strerror (errno));
@@ -553,8 +553,8 @@ void UDPOutput::BackgroundOutputWork() {
553
553
i.socketInfo ->errCount ++;
554
554
555
555
// failed to send all messages or it took more than 100ms to send them
556
- LogErr (VB_CHANNELOUT, " %s() failed for UDP output (key : %X output count: %d/%d time: %u ms errCount: %d) with error: %d %s\n " ,
557
- blockingOutput ? " sendmsg" : " sendmmsg" , i.id ,
556
+ LogErr (VB_CHANNELOUT, " %s() failed for UDP output (IP : %s output count: %d/%d time: %u ms errCount: %d) with error: %d %s\n " ,
557
+ blockingOutput ? " sendmsg" : " sendmmsg" , HexToIP ( i.id ). c_str () ,
558
558
outputCount, i.msgs .size (), diff, i.socketInfo ->errCount ,
559
559
errno,
560
560
strerror (errno));
@@ -618,8 +618,8 @@ int UDPOutput::SendData(unsigned char* channelData) {
618
618
socketInfo->errCount ++;
619
619
620
620
// failed to send all messages or it took more than 100ms to send them
621
- LogErr (VB_CHANNELOUT, " sendmmsg() failed for UDP output (key : %X output count: %d/%d time: %u ms errCount: %d) with error: %d %s\n " ,
622
- msgs.first ,
621
+ LogErr (VB_CHANNELOUT, " sendmmsg() failed for UDP output (IP : %s output count: %d/%d time: %u ms errCount: %d) with error: %d %s\n " ,
622
+ HexToIP ( msgs.first ). c_str () ,
623
623
outputCount, msgs.second .size (), diff, socketInfo->errCount ,
624
624
errno,
625
625
strerror (errno));
@@ -648,8 +648,8 @@ int UDPOutput::SendData(unsigned char* channelData) {
648
648
socketInfo->errCount ++;
649
649
650
650
// failed to send all messages or it took more than 100ms to send them
651
- LogErr (VB_CHANNELOUT, " sendmmsg() failed for UDP output (key : %X output count: %d/%d time: %u ms errCount: %d) with error: %d %s\n " ,
652
- msgs.first ,
651
+ LogErr (VB_CHANNELOUT, " sendmmsg() failed for UDP output (IP : %s output count: %d/%d time: %u ms errCount: %d) with error: %d %s\n " ,
652
+ HexToIP ( msgs.first ). c_str () ,
653
653
outputCount, msgs.second .size (), diff, socketInfo->errCount ,
654
654
errno,
655
655
strerror (errno));
@@ -860,3 +860,16 @@ void UDPOutput::StoppingOutput() {
860
860
}
861
861
}
862
862
}
863
+
864
+ std::string UDPOutput::HexToIP (unsigned int hex) {
865
+ // Extract each byte in LSB order
866
+ uint8_t octet1 = hex & 0xFF ; // Least significant byte
867
+ uint8_t octet2 = (hex >> 8 ) & 0xFF ;
868
+ uint8_t octet3 = (hex >> 16 ) & 0xFF ;
869
+ uint8_t octet4 = (hex >> 24 ) & 0xFF ; // Most significant byte
870
+
871
+ return std::to_string (octet1) + " ." +
872
+ std::to_string (octet2) + " ." +
873
+ std::to_string (octet3) + " ." +
874
+ std::to_string (octet4);
875
+ }
0 commit comments