From a6baf00956c73d40442a7ce23175e66e6c827e34 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 30 Mar 2017 13:21:05 +0100 Subject: [PATCH] Reordered command line parsing and replace throw with cout. --- examples/osgoscdevice/osgoscdevice.cpp | 26 ++++++++++++----------- src/osgPlugins/osc/ip/posix/UdpSocket.cpp | 5 ++++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/examples/osgoscdevice/osgoscdevice.cpp b/examples/osgoscdevice/osgoscdevice.cpp index 558a8c072..ea23a611b 100644 --- a/examples/osgoscdevice/osgoscdevice.cpp +++ b/examples/osgoscdevice/osgoscdevice.cpp @@ -402,6 +402,20 @@ int main( int argc, char **argv ) + std::string address; + std::string port; + + while (arguments.read("--address", address)) {} + while (arguments.read("--port", port)) {} + + bool use_zeroconf(false); + bool use_sender(false); + bool use_receiver(false); + if(arguments.find("--zeroconf") > 0) { use_zeroconf = true; } + if(arguments.find("--sender") > 0) { use_sender = true; } + if(arguments.find("--receiver") > 0) { use_receiver = true; } + + // read the scene from the list of file specified commandline args. osg::ref_ptr scene = osgDB::readRefNodeFiles(arguments); @@ -414,18 +428,6 @@ int main( int argc, char **argv ) scene = geode; } - std::string address; - std::string port; - - bool use_zeroconf(false); - bool use_sender(false); - bool use_receiver(false); - if(arguments.find("--zeroconf") > 0) { use_zeroconf = true; } - if(arguments.find("--sender") > 0) { use_sender = true; } - if(arguments.find("--receiver") > 0) { use_receiver = true; } - - while (arguments.read("--address", address)) {} - while (arguments.read("--port", port)) {} // construct the viewer. osgViewer::CompositeViewer viewer(arguments); diff --git a/src/osgPlugins/osc/ip/posix/UdpSocket.cpp b/src/osgPlugins/osc/ip/posix/UdpSocket.cpp index a9bd2babf..0888ab214 100644 --- a/src/osgPlugins/osc/ip/posix/UdpSocket.cpp +++ b/src/osgPlugins/osc/ip/posix/UdpSocket.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -185,7 +186,9 @@ public: { std::string errorString("error when calling send : "); errorString += strerror(errno); - throw std::runtime_error(errorString); + + std::cout<