Commit d912b16b authored by Tom Niget's avatar Tom Niget

Fix socket.hpp build

parent ab844a5f
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "builtins.hpp" #include "builtins.hpp"
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h>
#include <tuple> #include <tuple>
namespace py_socket { namespace py_socket {
...@@ -99,7 +100,9 @@ struct socket_t { ...@@ -99,7 +100,9 @@ struct socket_t {
hints.ai_protocol = proto; hints.ai_protocol = proto;
hints.ai_flags = flags; hints.ai_flags = flags;
addrinfo *res; addrinfo *res;
if (int err = ::getaddrinfo(host.c_str(), port.c_str(), &hints, &res); err != 0) { // convert port to string
std::string port_str = std::to_string(port);
if (int err = ::getaddrinfo(host.c_str(), port_str.c_str(), &hints, &res); err != 0) {
system_error(err, "getaddrinfo()"); system_error(err, "getaddrinfo()");
} }
return res; return res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment