From c2684ca1f5f8557fb92d5138d2e90462eb3539d3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 30 Mar 2017 12:18:16 +0100 Subject: [PATCH] Improved the error warning message --- src/osgPlugins/osc/ip/posix/UdpSocket.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/osc/ip/posix/UdpSocket.cpp b/src/osgPlugins/osc/ip/posix/UdpSocket.cpp index 080ef5a8e..a9bd2babf 100644 --- a/src/osgPlugins/osc/ip/posix/UdpSocket.cpp +++ b/src/osgPlugins/osc/ip/posix/UdpSocket.cpp @@ -179,9 +179,13 @@ public: { assert( isConnected_ ); - if (send( socket_, data, size, 0 ) < 0) + ssize_t result = send( socket_, data, size, 0 ); + + if (result < 0) { - throw std::runtime_error("error when calling send(..)\n"); + std::string errorString("error when calling send : "); + errorString += strerror(errno); + throw std::runtime_error(errorString); } }