From 064b1c36c05318ce75ec1076f1d70f73f2e1bb8f Mon Sep 17 00:00:00 2001 From: milek7 Date: Thu, 18 Jan 2018 20:00:06 +0100 Subject: [PATCH] motiontelemetry changes --- motiontelemetry.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/motiontelemetry.cpp b/motiontelemetry.cpp index 23fb4b96..404001b2 100644 --- a/motiontelemetry.cpp +++ b/motiontelemetry.cpp @@ -20,11 +20,8 @@ motiontelemetry::motiontelemetry() struct addrinfo hints, *res; memset(&hints, 0, sizeof(hints)); - protoent *pe = getprotobyname(conf.proto.c_str()); - if (!pe) - throw std::runtime_error("motiontelemetry: unknown protocol"); hints.ai_family = AF_UNSPEC; - hints.ai_socktype = pe->p_proto; + hints.ai_socktype = (conf.proto == "tcp" ? SOCK_STREAM : SOCK_DGRAM); if (getaddrinfo(conf.address.c_str(), conf.port.c_str(), &hints, &res)) throw std::runtime_error("motiontelemetry: getaddrinfo failed");