aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/src/io/udpConnection.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/hicn-light/src/io/udpConnection.c b/hicn-light/src/io/udpConnection.c
index c3e6d32ac..5fbdf4998 100644
--- a/hicn-light/src/io/udpConnection.c
+++ b/hicn-light/src/io/udpConnection.c
@@ -287,13 +287,20 @@ static bool _sendCommandResponse(IoOperations *ops, struct iovec *message){
return false;
}
#else
- ssize_t writeLength = write(udpConnState->udpListenerSocket, message[0].iov_base, (unsigned int)message[0].iov_len);
- if (writeLength < 0) {
- return false;
+ WSABUF dataBuf[2];
+ DWORD BytesSent = 0;
+
+ for (int i = 0; i < 2; i++) {
+ dataBuf[i].buf = message[i].iov_base;
+ dataBuf[i].len = (ULONG)message[i].iov_len;
}
- writeLength = write(udpConnState->udpListenerSocket, message[0].iov_base, (unsigned int)message[0].iov_len);
- if (writeLength < 0) {
- return false;
+
+ int rc = WSASendTo(udpConnState->udpListenerSocket, dataBuf, 2,
+ &BytesSent, 0, (SOCKADDR *)udpConnState->peerAddress,
+ udpConnState->peerAddressLength, NULL, NULL);
+
+ if (rc == SOCKET_ERROR) {
+ return false;
}
#endif
return true;