16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 15:59:18 +02:00

motiontelemetry changes

This commit is contained in:
milek7
2018-01-18 20:00:06 +01:00
parent 9f2be9cc23
commit 064b1c36c0

View File

@@ -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");