diff --git a/src/libYARP_OS/src/Run.cpp b/src/libYARP_OS/src/Run.cpp index 55552a6479d..a6e25d9548f 100644 --- a/src/libYARP_OS/src/Run.cpp +++ b/src/libYARP_OS/src/Run.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -494,8 +495,10 @@ int yarp::os::Run::server() if (!port.open(mPortName.c_str())) { + yError() << "Yarprun failed to open port: " << mPortName.c_str(); return YARPRUN_ERROR; } + yInfo() << "Yarprun succesfully started on port: " << mPortName.c_str(); pServerPort=&port; @@ -870,10 +873,12 @@ int yarp::os::Run::server() if (!port.open(mPortName.c_str())) { - if (mPortName[0]!='/') fprintf(stderr, "Invalid port name '%s', it should start with '/'\n", mPortName.c_str()); + yError() << "Yarprun failed to open port: " << mPortName.c_str(); + if (mPortName[0]!='/') yError("Invalid port name '%s', it should start with '/'\n", mPortName.c_str()); return YARPRUN_ERROR; } + yInfo() << "Yarprun succesfully started on port: " << mPortName.c_str(); pServerPort=&port; diff --git a/src/yarprun/yarprun.cpp b/src/yarprun/yarprun.cpp index 0c32014d26a..1c9908d1e88 100644 --- a/src/yarprun/yarprun.cpp +++ b/src/yarprun/yarprun.cpp @@ -11,12 +11,20 @@ #include #include +#include #include int main(int argc, char *argv[]) { yarp::os::Network yarp; + + if (!yarp.checkNetwork()) + { + yError("Sorry YARP network does not seem to be available, is the yarp server available?\n"); + return 1; + } + int ret=yarp::os::Run::main(argc,argv); return (ret!=0?1:0); }