comparison C++/SocketAddress.cpp @ 315:c9356cb38c86

Split sockets into SocketTcp and SocketUdp
author David Demelier <markand@malikania.fr>
date Mon, 02 Mar 2015 14:00:48 +0100
parents c019f194475a
children 890729b8cb60
comparison
equal deleted inserted replaced
314:4c3019385769 315:c9356cb38c86
54 std::memset(&hints, 0, sizeof (addrinfo)); 54 std::memset(&hints, 0, sizeof (addrinfo));
55 hints.ai_family = domain; 55 hints.ai_family = domain;
56 56
57 auto error = getaddrinfo(host.c_str(), std::to_string(port).c_str(), &hints, &res); 57 auto error = getaddrinfo(host.c_str(), std::to_string(port).c_str(), &hints, &res);
58 if (error != 0) 58 if (error != 0)
59 throw error::Error("getaddrinfo", gai_strerror(error), error); 59 throw SocketError("getaddrinfo", gai_strerror(error), error);
60 60
61 std::memcpy(&m_addr, res->ai_addr, res->ai_addrlen); 61 std::memcpy(&m_addr, res->ai_addr, res->ai_addrlen);
62 m_addrlen = res->ai_addrlen; 62 m_addrlen = res->ai_addrlen;
63 freeaddrinfo(res); 63 freeaddrinfo(res);
64 } 64 }