Skip to content
Snippets Groups Projects
Commit 5e82adcc authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Remove global scoping for htons and ntohs calls

On Ubuntu 18.04, it seems that these calls can be problematic (don't
really know why).
parent 94b47e42
No related branches found
No related tags found
1 merge request!130Support for output of ItemValue and ItemArray on ostream
...@@ -63,7 +63,7 @@ class Socket::Internals ...@@ -63,7 +63,7 @@ class Socket::Internals
int int
portNumber() const portNumber() const
{ {
return ::ntohs(m_address.sin_port); return ntohs(m_address.sin_port);
} }
int int
...@@ -180,7 +180,7 @@ connectServerSocket(const std::string& server_name, int port_number) ...@@ -180,7 +180,7 @@ connectServerSocket(const std::string& server_name, int port_number)
::memcpy(reinterpret_cast<char*>(&serv_addr.sin_addr.s_addr), reinterpret_cast<char*>(server->h_addr), ::memcpy(reinterpret_cast<char*>(&serv_addr.sin_addr.s_addr), reinterpret_cast<char*>(server->h_addr),
server->h_length); server->h_length);
serv_addr.sin_port = ::htons(port_number); serv_addr.sin_port = htons(port_number);
if (::connect(socket_internals.m_socket_fd, reinterpret_cast<sockaddr*>(&serv_addr), sizeof(serv_addr))) { if (::connect(socket_internals.m_socket_fd, reinterpret_cast<sockaddr*>(&serv_addr), sizeof(serv_addr))) {
throw NormalError(strerror(errno)); throw NormalError(strerror(errno));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment